It's been a long time since I authored a blog posting. It's not that I've been away from tech or not having the time to post, but I wanted to create a new blog focused on technologies I'm focusing on at work. Right now, my work has been looking towards goals with reducing hours in the Operation Center, which leads me to explore automation platforms like Ansible and Python in general. So this month I'm going to fork off this blog and create a new blog which contains the tech stuff, then my personal blog (this one) will stay with life topics.
Hope this makes things easier for myself and especially my readers.
Saturday, July 30, 2016
Sunday, August 09, 2015
Looking back upon O'Reilly School of Technology
As mentioned in the news, it looks like O'Reilly School of Technology is closing and giving students until end of this year to complete their course work. I posted about O'Reilly and my experience with the intro Linux class, which I liked but did have some objections. Basically, with the cost, felt you should have more materials and features included.
Looking back at the class, comparing this with the offering in 2015, it's very hard to justify the cost. Let's just use the example of the Intro to Linux class, at the time was close to $250 after a large discount. You can basically complete the same class for free through the Linux certification and Edx. Not only that, but the amount of resources has grown, not to mention more videos plus books. In other words, it's hard to pay staffing for a paid class if it's competing again free resources.
I'm hoping in the future we still see a trend towards more Linux based training. With the trend of learning to code making big waves, I still see a large lack of using Linux or even helping people take their code to live use. It's like many of these code schools are missing the gap, and they don't explain any sysadmin skills that would allow users to become "full stack".
Looking back at the class, comparing this with the offering in 2015, it's very hard to justify the cost. Let's just use the example of the Intro to Linux class, at the time was close to $250 after a large discount. You can basically complete the same class for free through the Linux certification and Edx. Not only that, but the amount of resources has grown, not to mention more videos plus books. In other words, it's hard to pay staffing for a paid class if it's competing again free resources.
I'm hoping in the future we still see a trend towards more Linux based training. With the trend of learning to code making big waves, I still see a large lack of using Linux or even helping people take their code to live use. It's like many of these code schools are missing the gap, and they don't explain any sysadmin skills that would allow users to become "full stack".
Monday, August 25, 2014
Resetting root password in Red Hat and CentOS 7
This process was a bit confusing and according to the official Red Hat documentation, has a few missing steps. I found the answer from another blog and this helped finally get to the real fix. Note, this is tested on CentOS7 on a VMware Workstation Virtual Machine.
1. During the boot process, press the E key at the Grub2 menu.
2. Scroll down using the arrow keys (not the Vi method) to the line starting with "linux". It would look like this "linux16 /vmlinuz-3.10.0..."
3. Remove the following entries from that line, "rhgb" and "quiet". If you leave these, they mess up the console and do not allow a password more than one character.
4. Add the following to the end of the line.
"init=/bin/sh".
5. Press ctrl+x to continue the boot process.
6. Once the system is booted, you will be at the root user in single user mode. But this is a read only file system. Validate this by using the following command. This should fail. # touch /tmp/test
7. You need to mount the / filesystem. Use the command as follows.
# mount -o remount, rw /
8. Test again that you can write to / after the remount.
# touch /tmp/test
9. Change the password for root.
# passwd
10. Touch the following file as a fix file process. This is for SELinux.
# touch /.autorelabel
11. Finally start the normal boot process. In some references you can use the reboot command but in my testing, it was not as stable.
# exec /sbin/init
12. Now login with the new password!
1. During the boot process, press the E key at the Grub2 menu.
4. Add the following to the end of the line.
"init=/bin/sh".
6. Once the system is booted, you will be at the root user in single user mode. But this is a read only file system. Validate this by using the following command. This should fail. # touch /tmp/test
7. You need to mount the / filesystem. Use the command as follows.
# mount -o remount, rw /
# touch /tmp/test
9. Change the password for root.
# passwd
10. Touch the following file as a fix file process. This is for SELinux.
# touch /.autorelabel
11. Finally start the normal boot process. In some references you can use the reboot command but in my testing, it was not as stable.
# exec /sbin/init
12. Now login with the new password!
Saturday, August 23, 2014
Coming back to my blog and my exam path
It's been a while since I updated this blog but wanted to keep people updated on my work and learning. Right now, I'm focusing on the Red Hat RHCE exam. About the end of 2012, I studied for the Red Hat RHCSA exam, which is the beginner exam focusing on the Red Hat Linux distro. The exam while difficult was a very good learning experience for myself, considering I'm still pretty new to the Linux world.
Since the certification is only valid for three years, I'm working on the next certification level, the RHCE. This exam is much harder and going to be more of a challenge for myself. The last exam I was able to self study but I really feel that I would greatly benefit from taking the official training class, especially since my work is offering to pay for it. The downside is I won't have the time to full prepare to pass the exam 100% but at least it's going to be five days of asking questions and at least getting to take a exam (even if I fail).
In other notes, I started up a site for the RHCSA and after it was abused by spammers, removed the entire MediaWiki install. It was painful but going to be an excuse to start it up again and remove all Red Hat trademarks from the site, just incase.
Monday, June 23, 2014
It's been a long time
This blog hasn't seen much attention in the past two years. Mostly I've been focusing on work and personal life, plus learning as well. Right now my focus on work is moving from system administration to more knowledge of scripting and operational tools. In the next few weeks, I'll start up posting my tutorials and also add more to certification study paths.
Saturday, August 04, 2012
More free resources
There's many many sources for education on the Internet that are free or nearly free. Recently I found a few links that are worth sharing.
Linux command line -
Linux the hard way command line - I haven't run through the site yet but this offers a more advanced tutorial than other sites I've seen. This looks really amazing, but I heard there was some issues with certain commands not work correctly. There's even a handy console session to help practice the commands.
The CLI Crash Course - This is a tutorial that is aimed towards the new command line user. The nice thing is a video class is also offered by Udemy for a very reasonable $9.
SQL -
Learn SQL the hard way - Another "learn the hardway" series, this one focusing on SQL. The examples and screenshots are clear as with the other methods.
Python -
Learn Python the hard way - This is another one in the series, but also offers video classes from Udemy for $29.
Invent with Python - I bought the hard copy book recently and enjoy the idea of learning to program while making a game. The book is available for free online but you can order a copy from Amazon as well.
GIT -
Git Immersion - This is more for coders and developers but it's also handy for the sysadmin or general user. Git is used for checking in code, and updating it as needed. This tutorial is actually very clear and easy to follow.
Linux command line -
Linux the hard way command line - I haven't run through the site yet but this offers a more advanced tutorial than other sites I've seen. This looks really amazing, but I heard there was some issues with certain commands not work correctly. There's even a handy console session to help practice the commands.
The CLI Crash Course - This is a tutorial that is aimed towards the new command line user. The nice thing is a video class is also offered by Udemy for a very reasonable $9.
SQL -
Learn SQL the hard way - Another "learn the hardway" series, this one focusing on SQL. The examples and screenshots are clear as with the other methods.
Python -
Learn Python the hard way - This is another one in the series, but also offers video classes from Udemy for $29.
Invent with Python - I bought the hard copy book recently and enjoy the idea of learning to program while making a game. The book is available for free online but you can order a copy from Amazon as well.
GIT -
Git Immersion - This is more for coders and developers but it's also handy for the sysadmin or general user. Git is used for checking in code, and updating it as needed. This tutorial is actually very clear and easy to follow.
Sunday, July 29, 2012
LPI LPIC-1 resources
I'm working on the exam notes but wanted to write more details I found on the exam. Below are links that may be helpful for anyone studying for the exam.
Reading
Wikibooks - LPI Certification - Books cover the LPIC-1 and other LPI certifications
Happy Monkey LPIC-1 Certification - Long listing of the LPIC-1 certification in HTML and PDF formats
IBM Developer Network LPIC-1 Certification - This is slightly outdated but still holds many helpful details
Reading
Wikibooks - LPI Certification - Books cover the LPIC-1 and other LPI certifications
Happy Monkey LPIC-1 Certification - Long listing of the LPIC-1 certification in HTML and PDF formats
IBM Developer Network LPIC-1 Certification - This is slightly outdated but still holds many helpful details
Friday, July 27, 2012
Studying for the LPIC-1 intro and outline
Since I'm studying for this certification I thought it would be a good idea to list the certification notes I have incase someone would like to also use them. The exact details of the exam are located at the LPI site but as with many exams, they are frequently updating the questions. The basis for my notes will be taken from the following link.
LPI - LPIC-1 Certification outline
Then to pass the certification, you need to pass two exams listed below. For now LPI has not added the recent updates to the full outline, so you will need to make sure you are current by reading both outlines.
LPI - Exam 101 - full outline
LPI - Exam 101 - updates as of July 2, 2012
LPI - Exam 102 - full outline
LPI - Exam 102 - updates as of July 2, 2012
Since this will focus on the subject of passing the LPIC-1, we will start by going over the requirements of the 101 exam.
Overview of the 101 exam
Exam 101 is broken down into four main sections.
1) System Architecture
2) Linux Installation and Package Management
3) GNU and Unix Commands
4) Devices, Linux Filesystems, Filesystem Hierarchy Standard
Each of the main sections have their subsection, which is related to the main section. For example the main section of Linux Installation and Package Management will discuss how to use the package manager yum.
Each of the exams has 60 questions that are a mix of multiple choice, multiple answers (choose two answers) and you need to score 500 or higher to pass. You are given 90 minutes to take the exam but this is actually a good amount of time and allows for reviewing of your questions. The exam I took also has a nice feature where you can mark the answers you are not sure with a "review" marker. This allows you to you return to these questions before finishing the exam.
Who should take this exam
From the LPI site, this LPIC-1 certification is a listed as a "Junior Level Linux Certification". Currently in the IT world, this certification and the CompTIA Linux+ are the standard Linux intro certifications available. There are many more Linux based certifications but from my personal research and also reading many employment listings, these are the certifications you most often see. Speaking of Linux+, if you pass the LPIC-1 certification you also qualify for the CompTIA Linux+ certification since they both use the same exams.
If you're just starting out in Linux or have a few years of experience I think this certification would be time well spent. Even if you do not follow through to the exams, the amount of information is much more than a regular Linux user would use, and can be helpful. Keep in mind that while there is technically a lot of information discussed, the total amount of depth is more shallow than other certifications. LPIC-1/Linux+ focuses on both distros (Debian and Red Hat) so their focus is not a deep as say the Red Hat RHCSA certification.
The questions also covered in the LPIC-1/Linux+ also are not something you often would use everyday in a Linux engineer or sysadmin role. Some comments on the certification have mentioned that the information is so rarely used that it doesn't make sense to study it (configuring IRQ's?) or it's just better to focus on other subjects leaving the details to an Internet search. The Red Hat RHCSA certification is above the LPIC-1/Linux+ in terms of difficulty and method of testing (all fill in the blank questions), and is normally considered the next Linux certification. The RHCSA also focuses more closely upon system administration tasks instead of a little bit of everything.
What will you need to study for the exam
I would recommend the following to help study for this or any exam.
LPI - LPIC-1 Certification outline
Then to pass the certification, you need to pass two exams listed below. For now LPI has not added the recent updates to the full outline, so you will need to make sure you are current by reading both outlines.
LPI - Exam 101 - full outline
LPI - Exam 101 - updates as of July 2, 2012
LPI - Exam 102 - full outline
LPI - Exam 102 - updates as of July 2, 2012
Since this will focus on the subject of passing the LPIC-1, we will start by going over the requirements of the 101 exam.
Overview of the 101 exam
Exam 101 is broken down into four main sections.
1) System Architecture
2) Linux Installation and Package Management
3) GNU and Unix Commands
4) Devices, Linux Filesystems, Filesystem Hierarchy Standard
Each of the main sections have their subsection, which is related to the main section. For example the main section of Linux Installation and Package Management will discuss how to use the package manager yum.
Each of the exams has 60 questions that are a mix of multiple choice, multiple answers (choose two answers) and you need to score 500 or higher to pass. You are given 90 minutes to take the exam but this is actually a good amount of time and allows for reviewing of your questions. The exam I took also has a nice feature where you can mark the answers you are not sure with a "review" marker. This allows you to you return to these questions before finishing the exam.
Who should take this exam
From the LPI site, this LPIC-1 certification is a listed as a "Junior Level Linux Certification". Currently in the IT world, this certification and the CompTIA Linux+ are the standard Linux intro certifications available. There are many more Linux based certifications but from my personal research and also reading many employment listings, these are the certifications you most often see. Speaking of Linux+, if you pass the LPIC-1 certification you also qualify for the CompTIA Linux+ certification since they both use the same exams.
If you're just starting out in Linux or have a few years of experience I think this certification would be time well spent. Even if you do not follow through to the exams, the amount of information is much more than a regular Linux user would use, and can be helpful. Keep in mind that while there is technically a lot of information discussed, the total amount of depth is more shallow than other certifications. LPIC-1/Linux+ focuses on both distros (Debian and Red Hat) so their focus is not a deep as say the Red Hat RHCSA certification.
The questions also covered in the LPIC-1/Linux+ also are not something you often would use everyday in a Linux engineer or sysadmin role. Some comments on the certification have mentioned that the information is so rarely used that it doesn't make sense to study it (configuring IRQ's?) or it's just better to focus on other subjects leaving the details to an Internet search. The Red Hat RHCSA certification is above the LPIC-1/Linux+ in terms of difficulty and method of testing (all fill in the blank questions), and is normally considered the next Linux certification. The RHCSA also focuses more closely upon system administration tasks instead of a little bit of everything.
What will you need to study for the exam
I would recommend the following to help study for this or any exam.
- Desktop or laptop with a processor that supports virtualization
- Desktop or laptop with at least 4GB of physical memory (the more the better)
- Virtualization software (Virtual Box, VMware Workstation, VMware Fusion)
- Books and resources
- Time and dedication
If you have a computer that allows virtualization then you can install the study Linux host very easily without having to worry about issues of using two physical machines for studying. Also most virtualization software allows you to take snapshots where you can "freeze" the machine at a certain time point, make some changes and if they don't work, roll back to the saved snapshot. It's extremely helpful when you are working with details of the system that could impact startup.
I would recommend to have at least 4GB of physical memory but since we're working with Linux, the requirements are pretty low. On my person laptop, I'm able to run two Linux hosts (one is Debian and the other is CentOS) very easily with no noticeable lag. Personally I like using my desktop more than my laptop since I can have many virtual machines running, but I can bring my laptop to work and it's very handy to study during lunch time.
Reading books and where to search for the answer is somewhat confusing. Since the LPI who creates the test does not officially offer a book, your left to choose from the popular certification book vendors. I personally used the All in one LPIC-1/CompTIA Linux+ Certification but heard high reviews for other books such as the Sybex Linux+ and also O'Reilly LPIC-1 in a nutshell book.
For the time and dedication, that it really the hardest part since you can't buy time. I would recommend to work on the exams section by section instead of reading the entire outline beginning to end. Making smaller check points for your goal will help stay focused instead of just focusing on finishing the certification. I would also recommend to work backwards, read the outline, then focus your study on these subjects.
Something that also helps, buy a large wall calendar and follow the Seinfeld method.
Let's get started
I'm going to start writing the notes for the System Architecture as I have time, and keep up the pace with my own exam study.
So close yet so far!
Today I took an exam for the LPIC-1 Linux certification exam, the first of two to complete the certification. I failed by a score less than 20 points from passing, which was much lower score than expected. It's annoying when you don't pass on two parts, first you technically (more on this later) lost the money you spent on the exam. Second, you feel like the time you spent studying was wasted since you didn't pass. But in reality, it's not exactly a lose/lose senario.
One of the method you prep for an exam is buying a book, then reading the book and focusing on the important details as mentioned by the author. Often times a certification book will focus more on passing the exam than actually getting knowledge of the subject the exam is testing. After this you may use the practice exam included in the book and once scoring high enough, will take the real exam. Hopfully passing the exam and on the way to the full certification.
But for some users, this doesn't work out so well. Books usually have limited space to discuss technical topics that dwell deeper than a few paragraphs. The narrow focus of just passing the exam often leaves more questions, now I know this command where would I use it? Not to mention that with the copy rights and agreements for the real exams, it's often difficult to find practice exams that are close to or near the real thing. Often you will pass the practice exam but find out the real exam is different.
So what is the best solution? It's really depending upon the person taking the exams and what they are used to. Personally I found the following to help me while studying.
Multiple sources for information
I was using just one book for my LPIC-1 study program, and often found myself searching the Internet for a better explanation of the topic that was written in the book. One such topic was "suid" which is when an executable file is set to give the permissions of the owner when ran. The book I was reading explained how to set this up but not why or when it's used. Searching the Internet I found a great site that actually explained the subject in a much easier method to understand and even offered straight forward examples.
At home, I also have two other books on the subject of the LPIC-1 certification and while I try to use one book and then the Internet searching, I will consult with these books plus other Linux books. Reason being is that certification books typically want to focus on passing the exam (which is why I buy them) but it's difficult to explain a complex subject within a limited amount of pages. If you have any doubt about the subject, research it further!
Real exam vs practice exam
Something that is common with almost every exam book I read is the included practice exam CD. Typically this is a practice exam produced by a popular exam vendor such as Transcender or MeasureUP. Usually the exams are limited compared to the full practice exams from the vendor companies, meaning that they have a smaller question pool or offer less features.
The big issue I see here is really a strange problem between the test vendors and the practice test vendors. The vendors who write and issue the certifications do not want their certifications to loose value, so they often will have agreements with the test takers to not report any of their questions. This is to make the exams harder to pass and also stop brain dumps. But also how do you study for an exam test if you're not sure what will be asked? Isn't that the point of using a practice exam?
One of the best advices I heard is save your money from the practice exams and just take the real exam. Now this is not the cheapest method, especially considering that most exams can cost anywhere from $150 (Microsoft exams), $400 (Red Hat RCHSA exams), and even higher for some of the high end exams. But you do get to take the exam in the real setting, and see the actual questions. Even if you do fail, you still come away with the experience and also a grading chart showing what parts you missed and needed work.
Plus the big benefit, if you score highly you actually pass the exam not just pass a practice exam. The hardest part is spending the money multiple times if you are unsure of your skills for the exam. This is really off set by doing a self study program instead of paying for a video series (usually $500) or taking a certification boot camp ($3,500).
For now I'm still working on finishing the certification, but I feel much better that I saw so close the first time rather than just guessing how close I was using practice tests.
One of the method you prep for an exam is buying a book, then reading the book and focusing on the important details as mentioned by the author. Often times a certification book will focus more on passing the exam than actually getting knowledge of the subject the exam is testing. After this you may use the practice exam included in the book and once scoring high enough, will take the real exam. Hopfully passing the exam and on the way to the full certification.
But for some users, this doesn't work out so well. Books usually have limited space to discuss technical topics that dwell deeper than a few paragraphs. The narrow focus of just passing the exam often leaves more questions, now I know this command where would I use it? Not to mention that with the copy rights and agreements for the real exams, it's often difficult to find practice exams that are close to or near the real thing. Often you will pass the practice exam but find out the real exam is different.
So what is the best solution? It's really depending upon the person taking the exams and what they are used to. Personally I found the following to help me while studying.
Multiple sources for information
I was using just one book for my LPIC-1 study program, and often found myself searching the Internet for a better explanation of the topic that was written in the book. One such topic was "suid" which is when an executable file is set to give the permissions of the owner when ran. The book I was reading explained how to set this up but not why or when it's used. Searching the Internet I found a great site that actually explained the subject in a much easier method to understand and even offered straight forward examples.
At home, I also have two other books on the subject of the LPIC-1 certification and while I try to use one book and then the Internet searching, I will consult with these books plus other Linux books. Reason being is that certification books typically want to focus on passing the exam (which is why I buy them) but it's difficult to explain a complex subject within a limited amount of pages. If you have any doubt about the subject, research it further!
Real exam vs practice exam
Something that is common with almost every exam book I read is the included practice exam CD. Typically this is a practice exam produced by a popular exam vendor such as Transcender or MeasureUP. Usually the exams are limited compared to the full practice exams from the vendor companies, meaning that they have a smaller question pool or offer less features.
The big issue I see here is really a strange problem between the test vendors and the practice test vendors. The vendors who write and issue the certifications do not want their certifications to loose value, so they often will have agreements with the test takers to not report any of their questions. This is to make the exams harder to pass and also stop brain dumps. But also how do you study for an exam test if you're not sure what will be asked? Isn't that the point of using a practice exam?
One of the best advices I heard is save your money from the practice exams and just take the real exam. Now this is not the cheapest method, especially considering that most exams can cost anywhere from $150 (Microsoft exams), $400 (Red Hat RCHSA exams), and even higher for some of the high end exams. But you do get to take the exam in the real setting, and see the actual questions. Even if you do fail, you still come away with the experience and also a grading chart showing what parts you missed and needed work.
Plus the big benefit, if you score highly you actually pass the exam not just pass a practice exam. The hardest part is spending the money multiple times if you are unsure of your skills for the exam. This is really off set by doing a self study program instead of paying for a video series (usually $500) or taking a certification boot camp ($3,500).
For now I'm still working on finishing the certification, but I feel much better that I saw so close the first time rather than just guessing how close I was using practice tests.
Monday, July 16, 2012
Preparing for an certification exam
The past two months I've been studying for the Linux+/LPIC-1 entry level Linux certification. The certification while entry level contains a large amount of details normally not used in daily operations, but still handy to know. So I went the typical route of buying the best rated book on Amazon, then going through the entire book chapter by chapter to study it. I feel the best way to study is writing down notes of the chapters, so I used Evernote from home and work.
After finishing the book, I continued on to the practice exams and found that I still didn't pick up most of the details from the book. I knew a large amount of details, improved my Linux knowledge overall, but the obscure details (font servers, etc.) were missed. I started to re-think my plan of studying, maybe I was going about this incorrectly?
I started to switch course and instead of using the book and going chapter by chapter, I checked out the actual guidelines for the exam. Here's LPIC-1 101 exam, which is one of two exams required for the certification. A nice feature of my book is that they include a PDF which following the exam and then gives you the chapter with page number where the topic is discussed. After switching to this method, I started to go down each section and take notes about the topic.
Since I was going straight to the answers, it was a much faster read and felt that I skipped over the unimportant (for the exam) topics. Also the big benefit is that I know for certain if I have a solid understanding of these topics, I can pretty much pass the test. But why and when would you want to read the book end to end?
If you need understanding how each component fits together, then I would recommend reading end to end. For example, if you're already using Linux or administration across other operating systems you know that troubleshooting often starts by reading the system logs. So you really don't need much back story as to why it's important to know the locations or using a search command (grep). For the newer users of Linux or someone fresh from school, they might not understand how important the logs are, then it would be good to read the entire chapter about logs and searching.
Also reading the book end to end allows you better understanding why you would need a search tool like grep then another tool like awk to help filter logs. A final good reason for reading the entire book is the examples and tutorials given in the book. Personally I feel that the tutorials help but the best method to learn is by figuring out yourself, which often leads to more research outside the book's text.
Something else to add, if you're preparing for an exam, use as many reliable sources of the information they you need. Currently I'm reading two books plus going over with two practice exams, and various information from the Internet. I'm pretty sure you could pass the test with just reading a single book but honestly it's a lot of information and there were questions left unanswered and just not possible to explain given the limited number of pages.
After finishing the book, I continued on to the practice exams and found that I still didn't pick up most of the details from the book. I knew a large amount of details, improved my Linux knowledge overall, but the obscure details (font servers, etc.) were missed. I started to re-think my plan of studying, maybe I was going about this incorrectly?
I started to switch course and instead of using the book and going chapter by chapter, I checked out the actual guidelines for the exam. Here's LPIC-1 101 exam, which is one of two exams required for the certification. A nice feature of my book is that they include a PDF which following the exam and then gives you the chapter with page number where the topic is discussed. After switching to this method, I started to go down each section and take notes about the topic.
Since I was going straight to the answers, it was a much faster read and felt that I skipped over the unimportant (for the exam) topics. Also the big benefit is that I know for certain if I have a solid understanding of these topics, I can pretty much pass the test. But why and when would you want to read the book end to end?
If you need understanding how each component fits together, then I would recommend reading end to end. For example, if you're already using Linux or administration across other operating systems you know that troubleshooting often starts by reading the system logs. So you really don't need much back story as to why it's important to know the locations or using a search command (grep). For the newer users of Linux or someone fresh from school, they might not understand how important the logs are, then it would be good to read the entire chapter about logs and searching.
Also reading the book end to end allows you better understanding why you would need a search tool like grep then another tool like awk to help filter logs. A final good reason for reading the entire book is the examples and tutorials given in the book. Personally I feel that the tutorials help but the best method to learn is by figuring out yourself, which often leads to more research outside the book's text.
Something else to add, if you're preparing for an exam, use as many reliable sources of the information they you need. Currently I'm reading two books plus going over with two practice exams, and various information from the Internet. I'm pretty sure you could pass the test with just reading a single book but honestly it's a lot of information and there were questions left unanswered and just not possible to explain given the limited number of pages.
Sunday, July 08, 2012
O'reilly School of Technology review
Computer based teaching is a very to get just right. Sometimes you may presented with too little information while other times, it's too much and hard to follow. I found some of the online classes I taken in the past for work was a 30 page slide show with a short quiz at the end. By the time I was through the first chapter, I was dulled by the information given and lack of interaction. On the side, a class presented me with one or two paragraphs of text and then expecting me to complete an assignment with no outside information.
But computer based training that is based on-line has many benefits. The pricing of classes is usually cheaper than attending a physical classroom. Also the classes are available 24 hours a day, which works out great work people with changing work hours. Combined with the information you have available anywhere, the benefits are welcome for anyone.
Recently I took it upon myself to take a class with O'reilly School of Technology, which is part of the O'reilly book publishing company (the animal tech book publisher). The class I enrolled with is the first Linux/UNIX class for their System Administration certificate. The class focuses on the file system which includes user/group administration, cron jobs, hard and soft links, plus more. It's a general overview of the system, but not too in depth as there are three other classes (four classes are required to complete the certificate).
From the start, you work the entire classroom from a web page, which includes accessing the lab server and the lessons. This makes it very handy as you can access your class from any computer with a web browser. Here I tested mostly Google's Chrome on Windows and Mac which no problems. The lab access while handy, does cost an additional monthly fee but going with this during a normal pace you should be done within two months of light weekend work. On the side note, you can also complete the work without the lab but the work will be harder to present to the course instructor.
When you login to your virtual classroom, you are presented with the following as seen below. You have a file explorer on the left side. Followed by the class lessons and reading in the middle, then on the right is the reading page. Below is the console login for your lab host. The simple method of presenting information worked well but I did noticed from all networks that I connected to, there was a delay in working with the lab console. Also a big plus is the lack of any Adobe Flash on the site, a huge thanks!
But computer based training that is based on-line has many benefits. The pricing of classes is usually cheaper than attending a physical classroom. Also the classes are available 24 hours a day, which works out great work people with changing work hours. Combined with the information you have available anywhere, the benefits are welcome for anyone.
Recently I took it upon myself to take a class with O'reilly School of Technology, which is part of the O'reilly book publishing company (the animal tech book publisher). The class I enrolled with is the first Linux/UNIX class for their System Administration certificate. The class focuses on the file system which includes user/group administration, cron jobs, hard and soft links, plus more. It's a general overview of the system, but not too in depth as there are three other classes (four classes are required to complete the certificate).
From the start, you work the entire classroom from a web page, which includes accessing the lab server and the lessons. This makes it very handy as you can access your class from any computer with a web browser. Here I tested mostly Google's Chrome on Windows and Mac which no problems. The lab access while handy, does cost an additional monthly fee but going with this during a normal pace you should be done within two months of light weekend work. On the side note, you can also complete the work without the lab but the work will be harder to present to the course instructor.
When you login to your virtual classroom, you are presented with the following as seen below. You have a file explorer on the left side. Followed by the class lessons and reading in the middle, then on the right is the reading page. Below is the console login for your lab host. The simple method of presenting information worked well but I did noticed from all networks that I connected to, there was a delay in working with the lab console. Also a big plus is the lack of any Adobe Flash on the site, a huge thanks!
The work is typically as follows. You are presented with a small chapter of information on a subject, which includes steps how you can do this in your lab console. Then you have a few assignments where you complete the work by either providing proof to the instructor (edit a file on X host) or by answering the question correctly. Then you are presented with a quiz, in a similar manner. It should be noted that none of these questions are multiple choice, and they are graded by a actual human.
After you submit the homework and quiz, the turn around time for the corrections is about 24~48 hours, but I saw much faster times especially during the weekdays. If you're answers are correct, then you move on to the next step but if they are incorrect, the points where you are incorrect are marked and notes are provided why. It's important to note that the questions do not change as far as I know. This means that if you fail the question on the first time, when you return to answer the question, it's the same.
The total amount of time to complete the class was about a month for myself, and that was taking my time, working on it as I wanted. For someone who was more focused, I'm sure this class could be done in a week, but I'm not sure just how fast the turn around for corrections could be completed.
The biggest question I had before attending this class is the pricing and what I would get from this. I personally dislike on-line classes, and I have taken classes from physical fitness, IT and math based subjects. All of them I felt lacked personal interaction and you mostly received generic answers and replies from the instructor. Also the lack of working with peers in the class also makes it more difficult to interact with other students for additional help or studying outside of the classroom.
With the O'reilly school, I felt that it was a good amount of information and the interaction was much better. While the subject matter felt less than what I expected I did learn from the assignments and also it forced me to really think about my answer since it wasn't just answering a random multiple choice quiz at the end. The depth of knowledge required for this class was entry level into the world of Linux/UNIX and I feel like it was a slightly below my skill level but I still came away with some details I didn't know.
Now if you are more focused on your own studying and can follow along in a book, this might not be the best value for you. You can find books and other learning materials available either free or for under $50 that offer much more information. But the big difference is that instead of working by yourself, you have someone to correct and assist in the labs with O'reilly. This doesn't sound like much but for some (especially myself) the contact with a instructor was extremely helpful. This also helps get you working harder and staying towards your goal since it's a live person you are working with, assigned to you.
From my experience with this first class in the series, I am not sure I would continue with the other four classes. This is mostly based upon a few factors, one is the cost (at current pricing they are $400 per class plus lab time) and the other is subject matter. I'm currently focusing to complete my LPIC-1 certification this summer and the classes offered by O'reilly while complete do not fully match the requirements of the exam. Also I want to further go into scripting and small amount of Python.
Personally I would recommend anyone who is interested in the O'reilly school to take advantage of the trial service which gives you limited access to the classes within seven days. If you don't like it, you can get a money back refund, but only if you do not go further than a set amount of lessons. Read the fine print before going too far in the class work as I heard it's something like 5 assignments (about two hours of work).
Friday, June 08, 2012
Umask confusion
I've been studying for the LPI LPIC-1 test, which is a basic introduction to Linux certification. So far it's been a very interesting experience, really finding out so much more about the nuts and bolts of Linux. But there are some confusion I'm having, and find it best to write it out to solve the problem.
One confusion is with the Umask function and command. Here's a short summary on the subject.
In the Linux and UNIX system, new files and directories are created with a default permission. Keep in mind the following.
One confusion is with the Umask function and command. Here's a short summary on the subject.
In the Linux and UNIX system, new files and directories are created with a default permission. Keep in mind the following.
- Read - 4
- Write - 2
- Execute - 1
- Files - 666
- Owner - Read, Write
- Group - Read, Write
- Other - Read, Write
- Directories - 777
- Owner - Read, Write, Execute
- Group - Read, Write, Execute
- Other - Read, Write, Execute
The owner is the user account who created the account, the group is the group associated with the file (most times it's the same as the user name), and the other is anyone who is authenticated on the system.
Now the issue is that on a system shared by multiple users, these settings leave little to be secured. How can the Linux system have the files locked down but still allow others access? This is where the command umask comes in. Umask allows the system to follow a default setting of security across the system, sort of a lock down depending upon how secure you want it.
Let's first find out what is the current umask setting.
- From your command prompt, run the following command
- #umask
- You should see a value such as "0022"
For most Linux distributions, the default is 0022. Only the last three values are used, the first "0" is not used. For this detail the settings of umask are as follows.
- umask setting of "0022"
- First "0" - Not used
- Second "0" - Amount to remove from default settings of owner permission
- Third "2" - Amount to remove from default settings of group permission
- Fourth "2" - Amount to remove from default settings of other permission
Sounds confusing but here's how this is calculated.
- umask setting of "0022"
- Files - default is 666
- Owner - 666 - 0 = 666
- Group - 666 - 2 = 664
- Other - 666 - 2 = 664
- Directories - default is 777
- Owner - 777 - 0 = 777
- Group - 777 - 2 = 775
- Other - 777 - 2 = 775
As you can see, the setting of "0022" (more commonly reported as 022 since we drop the first zero since it's not used) will remove permissions for Group and Other. This change is not so impacting but if we wanted we could make the system more secure by using higher amounts of umask. For example, 077 would give only the owner of the files the right to read, write and execute.
Now that we know the basics of the umask command, how can we change this? There's really two methods, one is from the command umask.
- From your command prompt, run the following command
- #umask 0026
- Now create a directory and file
- #mkdir testdir
- #touch testfile
- Let's see if the permissions are different than before
- #ls -l
- You should see the following permissions
- Testdir - 751 (rwx-rx-x)
- Testfile - 640 (rw-r--)
But the change done by umask is not permanent, to do that you need to edit the /etc/profile. You can view the file and find out that there's actually two values given in the file (here we are using CentOS). Why are there two values in the file?
The file script checks for the user account UID, and depending on the number, the user will either receive a umask of 002 or 022. Remember that service accounts are typically UID's under 200, while regular user accounts have UID's starting at 500 (typically). Also root has the UID of 1, so basically the system is giving a less enforced policy for more important accounts.
To view the account UID, in two methods.
- From the command prompt, run the following command
- #id -u useraccount
- Number returned will be your UID
- #cat /etc/passwd
- A full listing of all accounts on the system, showing UID
For more information about umask here are some very good links to read up on.
Tuesday, June 05, 2012
Script to help with timing issues on virtual guests
There's an issue when running a virtual machine that the time gets incorrectly updated. The problem is that when you suspend the computer, the virtual machine will suspend and return with the incorrect time, instead of updating from the Internet. I have seen this issue more so on Linux than on Windows, but for Linux it's easily fixed by a simple script. Here's the basic steps to get it working.
- Open up Vi or your favorite editor on your virtual machine
- Type in the following details
- #!/bin/bash
service ntpd stop
sleep 5
ntpdate pool.ntp.org
sleep 5
service ntpd start - Save you file
- Change the permissions to all the file to be executable
- Run the following command
- #chmod 755 filename
- Test the command
- Run the following command
- #date
- You should see an incorrect time
- Run the script, note the "./" before the script name
- #./yourtimescriptname
- Run the following command
- #date
- You should see the correct time
- Now your virtual machine is updated
- You can add this script to a cron job or login script to automate the process
So far I just run this manually since I rarely reboot the virtual machine or login or out. You can make a symbolic link or an alias to make things easier to manage.
Sunday, June 03, 2012
Adding a drive to VMware Workstation Linux guest without restarting
Recently I was working on a CentOS 6.2 guest on VMware Workstation 8 and I wanted to add an additional hard drive. From VMware Workstation I knew how to do this but not from the Linux side. Being unfamiliar with this, searched and found a few handy steps to add the drive without rebooting the Linux guest.
First, let's see what drives are showing up for the Linux guest. From the host we're going to check the /dev directory and see what drives are showing up.

Here we can see that there is three drives, sda, sdb and sdc listed on the guest. Under these two drives is three partitions titled sda1 and sda2, plus sdb1. Notied that drive sdc does not have any partitions. This breaks down like this.
From VMware Workstation, we're going to add the drive to the guest.
These commands were posted on another blog, Cyberciti's how to add a new VMware hard disk article.
First we're going to scan the system for the new drives. We need the host numbers on the guest machine first.
First, let's see what drives are showing up for the Linux guest. From the host we're going to check the /dev directory and see what drives are showing up.
#cd /dev
#ls
Here we can see that there is three drives, sda, sdb and sdc listed on the guest. Under these two drives is three partitions titled sda1 and sda2, plus sdb1. Notied that drive sdc does not have any partitions. This breaks down like this.
- SDA
- SDA1
- SDA2
- SDB
- SDB1
- SDC
- No partitions
From VMware Workstation, we're going to add the drive to the guest.
- Right click the guest, and click the "Settings"
- The Virtual Machine Settings window will open
- Click the "add" button
- The "Add Hardware Wizard" window will open
- Select "Hard Disk" then click the "Next" button
- Under the "Select a Disk" leave the default as "Create a new virtual disk", then click the "Next" button
- Under the "Select a Disk Type" leave the default as "SCSI", then click the "Next" button
- Under the "Specify Disk Capacity", change the value for "Maximum disk size (GB)" to the amount you want. For this example, I will be using 5GB. Then click the "Next" button
- Under the "Specify Disk File" leave the file name as default and then click the "Finish" button
- Back at the "Virtual Machine Settings" window, click the "OK" button to complete
- The new drive has been added to the guest
These commands were posted on another blog, Cyberciti's how to add a new VMware hard disk article.
First we're going to scan the system for the new drives. We need the host numbers on the guest machine first.
- First find the host number on your system
- Run the following command
- #ls /sys/class/scsi_host
- You should see the return of "host0" or more
- Force the system to scan the drives
- The host number you found in the previous step will be used here.
- Run the following command
- #echo "- - -" > /sys/class/scsi_host/host2/scan (note on my system it's "host2")
- After this you may see a message of the drive scanned on the machine
- To confirm, check the logs for messages of new drive
- Run the following command
- #tail /var/log/messages
- This will be sequential from the last drives. For example, if you see in /dev drives SDA, SDB, then you should see logs for drive SDC
- From fdisk we're going to also validate it's showing up
- Run the following command
- #fdisk -l
- You should see the drive showing up that matches the drive from step 3
- From /dev you should also see the new drive listed
- Run the following command
- #ls /dev
- You should see the drive showing up that you just added
- First find the drive has been discovered on the system
- Run the following command
- #fdisk -l | grep 'Disk'
- You should see the drive you added in the previous steps shown near the end of the list
- Save this information for the next steps.
- Run fdisk to create the partition on the new disk (if anytime you get lost on commands, type "m" for the command menu
- Run the following command
- #fdisk /dev/sdd (your drive may be different)
- In fdisk, type "n" to create a new partition
- Type "p" for a primary partition
- Type "1" for a partition number
- Type "1" for a first cylinder number
- Type "1G" for size (this can be adjusted for your needs)
- Type "w" to write and save the information
- This will automatically close fdisk
- Validate the partition is now showing up in /dev directory
- Run the following command
- #ls /dev
- You should see the new partition showing up under the drive you just created
- We're now going to format the partition with ext3 so that it's usable
- Run the following command
- #mkfs.ext3 /dev/sdd1
- You should see confirmation the command was successful
- Finally we are going to mount the drive
- Run the following commands
- #mkdir /disk1
- #mount /dev/sdd1 /disk1 (your drive may be different)
- Confirm the drive is showing up
- Run the following command
- #df -H
- You should see your new drive mounted
- Test the new mount
- Run the following commands
- #touch /disk1/testfile
- #ls /disk1
- You should see your file written to the new mount
- Now set the mount at boot
- Run the following command
- #vi /etc/fstab
- Add the following line to the fstab file (note, I'm not going to show basic Vi commands here, you can find them across the Internet)
- /dev/sdd1 /disk1 ext3 defaults 1 2
- Save the file
- Done!
Sunday, December 04, 2011
Install HTOP on FreeBSD
Working with command line I really miss some of the nice graphics you find with Windows based tools. The current Windows Resource Monitor included in Windows 7 and Windows Server 2008 is really my favorite. It's great to use for monitoring as it's a real time graph of the system performance. I know that Linux/UNIX tools like TOP can do the same but it's just visually easier to view a graph than numbers.
I recently started to use HTOP which is a more graphical version of TOP but is not as popular. The downside is that while it's more handy, you may need to have it installed manually, it's typically not included by default. Below is a screenshot of HTOP running.
Installing HTOP in CentOS is extremely simple.
#yum install htop
Done! For Debian based systems, use the following command.
$sudo apt-get install htop
Simple and easy, now run htop. But what if you want to install htop for FreeBSD? That's going to take a little bit more work.
Good news is that HTOP is available from the FreeBSD ports collection. This will make the process much easier that installing from source.
http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/htop/
For the actual installing, I following a few blogs and forum postings. One from The Technical Crib pointed me how to install the Linux emulators for FreeBSD. But after following the steps I received another error during the install process, which was covered in this FreeBSD forum posting. Finally, as suggested in the previous link, the fix was to install the source, found how to do that in this Cyberciti blog posting.
Below I will write out the full steps that worked for me, didn't discover this but it's complied between all the articles I found.
Installing the requirements
1) Su or login as root
2) Run the command to enable Linux binarary compatibility for FreeBSD.
#kldload linux
3) Add to the startup
Edit /etc/rc.conf
Add following line
linux_enable="YES"
4) Install Linux base port f10.
#make install clean
5) Add linproc to fstab
Edit /etc/fstab
Add following line
linproc /compat/linux/proc linprocfs rw 0 0
6) Install Htop from the port
#cd /usr/ports/sysutils/htop
#make install clean
7) Htop should run!
$htop
Possible extra step
*note - htop should complete the install with no problems. If you see an error as the following, you may need to install the source files to your computer.
Error result ***
===> Configuring for lsof-4.84A,5
Creating ./lockf_owner.h from /usr/src/sys/kern/kern_lockf.c
FATAL ERROR: can't read /usr/src/sys/kern/kern_lockf.c
FATAL ERROR: ./lockf_owner.h creation failed (see 00FAQ)
===> Script "Configure" failed unexpectedly.
Please report the problem to ler@lerctr.org [maintainer] and attach the
"/usr/ports/sysutils/lsof/work/lsof_4.84A.freebsd/config.log" including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Stop in /usr/ports/sysutils/lsof.
*** Error code 1
Stop in /usr/ports/sysutils/htop.
*** Error code 1
Stop in /usr/ports/sysutils/htop.
Error result ***
I am using FreeBSD version 8.2 stable and saw this error, so I followed one of the links posted and installed the kernel source code. We're going to run through some settings with FreeBSD's sysinstaller, it's kinda of confusing but take your time and carefully tab around.
1) Su as root
2) Run the sysinstaller
#sysinstall
3) Select "Options", then tab to the "Select" button, press enter
4) Under the Options Editor, use the arrow keys to scroll down to "Release Name" value, we are going to change this by removing the "-p3" after "RELEASE". Press the space bar to open an edit window.
5) In the edit window, remove the "-P3" value. This is done because when we download the source files, it does not know where to find this source. Tab to "Ok" when done. Then press "q" to quit to the main screen.
6) Back at the main sysinstaller screen we are going to select "Configure", then tab to "Select" and press enter.
7) Use the arrow keys to select "Distributions" then then use the space bar to select to continue.
8) On the next page, scroll down again using the arrow keys and select "SRC - Sources for everything". Press the space bar to select.
9) Under the sub-components, you will need to select two source trees, Base and Sys. Scroll down again using the arrow keys and select the following with the space bar.
"Base - top-level files in /usr /src"
"Sys - /usr/src/sys (FreeBSD kernel)"
Tab to the "Ok" button again.
10) After this you will be prompted where to install the files from (CD/DVD/FTP, etc.). Since this is a smaller download, I would suggest FTP, and first starting with the main FTP site. Now if the FTP fails with the following error message
Warning: Can't find the '8.2-RELEASE-P3' distribution on this FTP server
Go back to step 5 and make sure you edited the name.
Htop should finally run as normal! Yes, this was a pain but considering it's running a Linux based tool, wasn't that bad!
Rob
I recently started to use HTOP which is a more graphical version of TOP but is not as popular. The downside is that while it's more handy, you may need to have it installed manually, it's typically not included by default. Below is a screenshot of HTOP running.
Installing HTOP in CentOS is extremely simple.
#yum install htop
Done! For Debian based systems, use the following command.
$sudo apt-get install htop
Simple and easy, now run htop. But what if you want to install htop for FreeBSD? That's going to take a little bit more work.
Good news is that HTOP is available from the FreeBSD ports collection. This will make the process much easier that installing from source.
http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/htop/
For the actual installing, I following a few blogs and forum postings. One from The Technical Crib pointed me how to install the Linux emulators for FreeBSD. But after following the steps I received another error during the install process, which was covered in this FreeBSD forum posting. Finally, as suggested in the previous link, the fix was to install the source, found how to do that in this Cyberciti blog posting.
Below I will write out the full steps that worked for me, didn't discover this but it's complied between all the articles I found.
Installing the requirements
1) Su or login as root
2) Run the command to enable Linux binarary compatibility for FreeBSD.
#kldload linux
3) Add to the startup
Edit /etc/rc.conf
Add following line
linux_enable="YES"
4) Install Linux base port f10.
#cd /usr/ports/emulators/linux_base-f10
#make install clean
5) Add linproc to fstab
Edit /etc/fstab
Add following line
linproc /compat/linux/proc linprocfs rw 0 0
6) Install Htop from the port
#cd /usr/ports/sysutils/htop
#make install clean
7) Htop should run!
$htop
Possible extra step
*note - htop should complete the install with no problems. If you see an error as the following, you may need to install the source files to your computer.
Error result ***
===> Configuring for lsof-4.84A,5
Creating ./lockf_owner.h from /usr/src/sys/kern/kern_lockf.c
FATAL ERROR: can't read /usr/src/sys/kern/kern_lockf.c
FATAL ERROR: ./lockf_owner.h creation failed (see 00FAQ)
===> Script "Configure" failed unexpectedly.
Please report the problem to ler@lerctr.org [maintainer] and attach the
"/usr/ports/sysutils/lsof/work/lsof_4.84A.freebsd/config.log" including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Stop in /usr/ports/sysutils/lsof.
*** Error code 1
Stop in /usr/ports/sysutils/htop.
*** Error code 1
Stop in /usr/ports/sysutils/htop.
Error result ***
I am using FreeBSD version 8.2 stable and saw this error, so I followed one of the links posted and installed the kernel source code. We're going to run through some settings with FreeBSD's sysinstaller, it's kinda of confusing but take your time and carefully tab around.
1) Su as root
2) Run the sysinstaller
#sysinstall
3) Select "Options", then tab to the "Select" button, press enter
4) Under the Options Editor, use the arrow keys to scroll down to "Release Name" value, we are going to change this by removing the "-p3" after "RELEASE". Press the space bar to open an edit window.
5) In the edit window, remove the "-P3" value. This is done because when we download the source files, it does not know where to find this source. Tab to "Ok" when done. Then press "q" to quit to the main screen.
6) Back at the main sysinstaller screen we are going to select "Configure", then tab to "Select" and press enter.
7) Use the arrow keys to select "Distributions" then then use the space bar to select to continue.
8) On the next page, scroll down again using the arrow keys and select "SRC - Sources for everything". Press the space bar to select.
9) Under the sub-components, you will need to select two source trees, Base and Sys. Scroll down again using the arrow keys and select the following with the space bar.
"Base - top-level files in /usr /src"
"Sys - /usr/src/sys (FreeBSD kernel)"
Tab to the "Ok" button again.
10) After this you will be prompted where to install the files from (CD/DVD/FTP, etc.). Since this is a smaller download, I would suggest FTP, and first starting with the main FTP site. Now if the FTP fails with the following error message
Warning: Can't find the '8.2-RELEASE-P3' distribution on this FTP server
Go back to step 5 and make sure you edited the name.
Htop should finally run as normal! Yes, this was a pain but considering it's running a Linux based tool, wasn't that bad!
Rob
Wednesday, November 30, 2011
Alias, making quick custom commands
Recently I placed my home computer on the Internet for a remote access but also to run a personal web page. The problem I had is while I enabled ssh access using only private keys, I was still worried that I might leave a loop hole open on the system.
So here I was constantly checking the logs for any alerts to SSHD service. The command I would run is something simple, "tail /var/log/messages | grep sshd".
The results would typically something as simple as a few lines but it would be important to keep up on. Here's an example.
$ tail /var/log/messages | grep sshd
Nov 25 03:13:59 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 03:14:06 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 05:50:25 server1 sshd[1299]: error: PAM: authentication error for illegal user root from 192.168.1.100
So here I was constantly checking the logs for any alerts to SSHD service. The command I would run is something simple, "tail /var/log/messages | grep sshd".
The results would typically something as simple as a few lines but it would be important to keep up on. Here's an example.
$ tail /var/log/messages | grep sshd
Nov 25 03:13:59 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 03:14:06 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 05:50:25 server1 sshd[1299]: error: PAM: authentication error for illegal user root from 192.168.1.100
Now this is kinda of a long command to type out each time, I was wondering if I could just type something shorter?
Here's where the alias command comes into play. From your terminal, you can type "alias" and find out what are your current alias commands.
$ alias
g='egrep -i'
h='fc -l'
j=jobs
l='ls -l'
ll='ls -laFo'
m=more
We're now going to add our search command as listed above, but make an alias to "searchsshd".
$ alias searchsshd='tail /var/log/messages | grep sshd'
Now, when we type "searchsshd" we get the following.
$ tail /var/log/messages | grep sshd
Nov 25 03:13:59 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 03:14:06 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 05:50:25 server1 sshd[1299]: error: PAM: authentication error for illegal user root from 192.168.1.100
Nov 25 03:13:59 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 03:14:06 server1 sshd[927]: error: PAM: authentication error for user from 192.168.1.100
Nov 25 05:50:25 server1 sshd[1299]: error: PAM: authentication error for illegal user root from 192.168.1.100
Pretty cool!
Rob
Hard links vs Symbolic links
Working with Linux and UNIX offers some handy extras not typically found on Windows based systems. One great feature is hard and soft links, which is somewhat like a shortcut that you can create but looks just like a normal file.
This works great when you need to share a file but do not want to give permissions to the file directly. So how does this work? Every file on a Linux or UNIX based system is mapped to an inode. Inodes are the identification of every single file and object on the system. This includes users, files, rights, etc.
To see the inode values, you can run the command "ls -i".
rob@robmint ~/sandbox $ ls -li
total 4
2098382 -rw-r--r-- 1 rob rob 5 2011-11-30 17:29 testfile
The file "testfile" has a inode value of "2098382".
Now there are two different links we can create. One is a hard link, the other is a soft link. Here's the difference.
Hard link - These are files associated to the same inode. They are duplicate files and are independent from the original file. Also as you can see below, look the same but there is a slight hint.
Let's first create the hard link using the "ln" command.
rob@robmint ~/sandbox $ ln testfile testfilehardlink
rob@robmint ~/sandbox $ ls -li
total 8
2098382 -rw-r--r-- 2 rob rob 5 2011-11-30 17:29 testfile
2098382 -rw-r--r-- 2 rob rob 5 2011-11-30 17:29 testfilehardlink
So we mentioned that hard links are duplicates of the original file, but what happens when we delete the original file? Let's find out. We will delete the file "testfile" and leave behind "testfilehardlink".
rob@robmint ~/sandbox $ rm testfile
rob@robmint ~/sandbox $ ls -li
total 8
2098382 -rw-r--r-- 1 rob rob 5 2011-11-30 17:29 testfilehardlink
Now the original file is deleted, let's try to access the file "testfilesoftlink".
rob@robmint ~/sandbox $ cat testfilesoftlink
cat: testfilesoftlink: No such file or directory
This works great when you need to share a file but do not want to give permissions to the file directly. So how does this work? Every file on a Linux or UNIX based system is mapped to an inode. Inodes are the identification of every single file and object on the system. This includes users, files, rights, etc.
To see the inode values, you can run the command "ls -i".
rob@robmint ~/sandbox $ ls -li
total 4
2098382 -rw-r--r-- 1 rob rob 5 2011-11-30 17:29 testfile
The file "testfile" has a inode value of "2098382".
Now there are two different links we can create. One is a hard link, the other is a soft link. Here's the difference.
Hard link - These are files associated to the same inode. They are duplicate files and are independent from the original file. Also as you can see below, look the same but there is a slight hint.
Let's first create the hard link using the "ln" command.
rob@robmint ~/sandbox $ ln testfile testfilehardlink
Now let's see what we created.
rob@robmint ~/sandbox $ ls -li
total 8
2098382 -rw-r--r-- 2 rob rob 5 2011-11-30 17:29 testfile
2098382 -rw-r--r-- 2 rob rob 5 2011-11-30 17:29 testfilehardlink
Again, we see the inode information is the same, but also note the value of "2". Which tells us that the original file "testfile" is linked two times, once to "testfile" and another to "testfilehardlink".
So we mentioned that hard links are duplicates of the original file, but what happens when we delete the original file? Let's find out. We will delete the file "testfile" and leave behind "testfilehardlink".
rob@robmint ~/sandbox $ rm testfile
rob@robmint ~/sandbox $ ls -li
total 8
2098382 -rw-r--r-- 1 rob rob 5 2011-11-30 17:29 testfilehardlink
Now let's see if we can access "testfilehardlink".
rob@robmint ~/sandbox $ cat testfilehardlink
1234
It works! Now, even after deleting the original, you can still access the data. But this looses the benefit of using link since now the file is no longer being updated from the original file.
So now we know hard links, what about soft links? Let's create the soft links using the "ln -s" command.
rob@robmint / $ ln -s testfile2 testfilesoftlink
Now let's look at the soft link we created. Notice how there is a visual reminder that it's a soft link.
rob@robmint ~/sandbox $ ls -li
total 8
2097736 -rw-r--r-- 1 rob rob 10 2011-11-30 17:41 testfile2
2098382 -rw-r--r-- 1 rob rob 5 2011-11-30 17:29 testfilehardlink
2098638 lrwxrwxrwx 1 rob rob 9 2011-11-30 17:48 testfilesoftlink -> testfile2
Here we created the the soft link, but let's see how this works if we delete the original file.
rob@robmint ~/sandbox $ rm testfile2
rob@robmint ~/sandbox $ ls -li
total 8
2098383 -rw-r--r-- 2 rob rob 5 2011-11-30 17:50 testfile
2098383 -rw-r--r-- 2 rob rob 5 2011-11-30 17:50 testfilehardlink
2098638 lrwxrwxrwx 1 rob rob 9 2011-11-30 17:48 testfilesoftlink -> testfile2
Now the original file is deleted, let's try to access the file "testfilesoftlink".
rob@robmint ~/sandbox $ cat testfilesoftlink
cat: testfilesoftlink: No such file or directory
As you can see, once the original file is gone, so it the soft link file. This is because the soft link is a link to the inode, not a duplicate file.
Now, why would you want to use soft links over hard links? Soft links are a path back to the file, not to the inode, which means that you can access links across partitions. It's pretty cool feature and when working with longer path names this could be extremely handy.
Rob
Friday, November 25, 2011
SSH access with keys and no password
One of the most handy things about SSH access is setting up the secure keys, allowing to bypass the password but keep a very secure access to the host. This allows a fast connection to the host, but also since you're using a security key, no one else will have access.
For a while I was having issues setting this up, I knew that you needed to create the keys but not sure how to setup ssh access further. So I setup a home server, using FreeBSD 8.2 at home and running a port forwarding from my home router. I wanted to keep this secure as possible, but also allow access from any location, so I could access my home system remotely.
So here's the steps I used and hoping this will be helpful.
First, if you're on a Windows system there might be some issues creating the keys. You can make keys from Putty but there is some differences, mostly you will need to rename the files and make some additional editing. In these examples I created the keys on a Ubuntu based system and accessing a FreeBSD host. Please note "user" is your account name and "hostname" is the machine name.
Before starting, make sure you have your remote host setup if needed. Here I'm working on a home machine so I need to first edit the SSH service file located at /etc/ssh/sshd_config. I recommend using your favorite text editor, and will be listing only the important options below.
First, make sure root SSH login is disabled, and only allowing your account to be listed.
AllowUsers user
We are also going to disable password authentication.
PasswordAuthentication no
Also allow RSA keys.
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
Save the file and restart sshd service. Now consider if you are accessing a company server the details will be different and these setup steps for the host might be already done.
From your personal computer.
1) Login to a host and access the terminal or console.
2) From you're home directory, run the following command.
user@hostname ~ $ ssh-keygen -t rsa
3) As seen below, you will be asked for the following details. You can take the defaults and press "enter" all the way through. If you would like added security, enter a passphrase when prompted.
user@hostname ~ $ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
[random letters and numbers] user@hostname
The key's randomart image is:
+--[ RSA 2048]----+
[random image]
4) Now check your directory and you should see the following files. The specific path is listed above as "/home/user/.ssh" directory. We are using the "a" option to view the .ssh directory since it is hidden.
user@hostname ~ $ ls -la
drwx------ 2 user user 4096 2011-11-25 15:18 .ssh
5) So we have the directory there, now let's check for the files. We are going to change directory to .ssh and look for the files.
user@hostname ~/.ssh $ cd .ssh
6) We are looking for what files are in the directory.
user@hostname ~/.ssh $ ls -l
total 20
drwx------ 2 user user 4096 2011-11-25 15:18 .
drwxr-xr-x 57 user user 4096 2011-11-25 14:55 ..
-rw------- 1 user user 1675 2011-11-25 15:18 id_rsa
-rw-r--r-- 1 user user 393 2011-11-25 15:18 id_rsa.pub
-rw-r--r-- 1 user user 884 2011-11-25 15:01 known_hosts
7) We have two hosts that are important. id_rsa and id_rsa.pub, these are the two files which we created and will need to access remote hosts.
id_rsa - This is your private key, you keep this on the computer that you are using to access other computers. This is a secure file not to be shared on remote systems but only on hosts you are using for clients.
id_rsa.pub - This is the public key, you place this file on remote systems that you want to access remotely.
8) Now we have the two files needed, we're going to copy the id_rsa.pub file to our remote system. This command will copy the files from your local id_rsa.pub to the remote host.
user@hostname ~/.ssh $ cat id_rsa.pub | ssh user@192.168.1.1 'cat >> .ssh/authorized_keys'
Password:
There is a possibility this might fail. Make sure that under your home directory on the remote system you have .ssh directory and the file authorized_keys already created. If they are not there, then create them as needed. Below, run the commands from your home directory.
user@hostname ~ $ mkdir .ssh
Now we are going to lock down the directory
user@hostname ~ $ chmod 700 .ssh
Now go inside the .ssh directory
user@hostname ~ $ cd .ssh
We are going to create a blank file to store the keys
user@hostname ~ $ touch authorized_keys
Again, we are going to lock this file down as well
user@hostname ~ $ chmod 600 authorized_keys
Now try the command listed in step 8 again. This should work.
9) Now try to ssh into the server again, you should not be prompted for the password and go straight to the terminal session.
Hope this saves you time and keeps your system secure.
Rob
Sunday, September 04, 2011
Windows Freeware applications list
The word free and Windows don't often go together. It's very common to find free open source applications in the Linux world but in Windows it's a bit harder to find, but they are there.
Recently I found a few nice listing of free applications that are free or offer free trial versions. Really handy listing and some of the applications are just what you need for something small.
So my personal list of free or open source applications for Windows is here.
Filezilla - FTP client and server
Before I found Filezilla I was stuck using either the command line for FTP upload, Dreamweaver, or another paid FTP program. Granted FTP isn't something that requires a great deal of knowledge, but it just made things easier to use a mouse. Filezilla is basically everything you could want in an FTP client, I've been using it for years and never had any issues.
AVG Free Client - Antivirus
I have never compared anti-virus vendors but the interface of AVG is very simple and easy to use. AVG offers frequent updates and of course they ask that you upgrade to the paid version, which offers more options and protection. Personally it's a tie between AVG and other vendors that offer a free version but AVG seems cleaner.
Pidgin - IM and IRC client
There's many instant messenger clients and IRC clients out there but the interface of Pidgin is decently easy to use. The only issue is using some of the extra features that are included with the vendor's instant messenger client might not work 100% with Pidgin. For example Yahoo! Messenger conference does not appear to work correctly with Pidgin, but that's a minor issue.
VLC - Media player
VLC is a handy media player that I often use over Windows Media Player. The best feature is this is a very universal player, can play pretty much any file you throw at it.
FooBar2000 - Music player
My favorite music players have been Winamp and iTunes, but recently I have been using FooBar as it's lightweight and simple to look for files. There is many plugins available for FooBar and if you're looking for the simple music player interface this is highly recommended.
CutePDF - Print to PDF
I have a love hate issue with Adobe's PDF format. I like how it's very simple to hold books but creating PDF's was an issue, if you didn't have the software there was little you could do. With CutePDF, you can print to PDF which is very handy and great for "recording" web pages or logging documents. I heavily use this for capturing e-mails or invoices that are in HTML format for archival.
Imgburn - CD DVD burner
Imgburn is very handy for create CD or DVD's plus creating ISO of physical media. The application is lightweight, offers a much simpler method than working with Nero. My only request is disabling the "successful" sound as it's annoying.
TrueCrypt - Encryption
TrueCrypt offers drive and directory encryption, plus ability to encrypt the hard drive upon bootup. Where this comes in handy is when you need to secure a directory from others, or when you need to have a laptop secured even if you loose it. It's also great to use for your USB memory sticks, and I highly recommend this be used since it locks down the file very securely.
Notepad ++ - Text editor
Using Microsoft's Notepad is handy but doesn't offer correct formatting and other tools as does Notepad ++. I really like this application and even after buying a very expensive paid version of another text editor, still use Notepad ++.
Putty - SSH client
I honestly do not know of another SSH client for Windows that is free and highly used as is Putty. I just recently switched to using SecureCRT, a paid SSH client but only after I needed a feature not included with Putty. But I really liked Putty and used it for many years.
Rich Copy - File copy utility
I've been using Microsoft's Robocopy and the add on TeraCopy but recently I found Rich Copy from Microsoft. I really like the interface of Rich Copy and the adjustments for the job which is handy for faster computers. It's also good for sync a directory or just auditing.
For now these are my favorites and will add some more shortly.
Rob
Recently I found a few nice listing of free applications that are free or offer free trial versions. Really handy listing and some of the applications are just what you need for something small.
So my personal list of free or open source applications for Windows is here.
Filezilla - FTP client and server
Before I found Filezilla I was stuck using either the command line for FTP upload, Dreamweaver, or another paid FTP program. Granted FTP isn't something that requires a great deal of knowledge, but it just made things easier to use a mouse. Filezilla is basically everything you could want in an FTP client, I've been using it for years and never had any issues.
AVG Free Client - Antivirus
I have never compared anti-virus vendors but the interface of AVG is very simple and easy to use. AVG offers frequent updates and of course they ask that you upgrade to the paid version, which offers more options and protection. Personally it's a tie between AVG and other vendors that offer a free version but AVG seems cleaner.
Pidgin - IM and IRC client
There's many instant messenger clients and IRC clients out there but the interface of Pidgin is decently easy to use. The only issue is using some of the extra features that are included with the vendor's instant messenger client might not work 100% with Pidgin. For example Yahoo! Messenger conference does not appear to work correctly with Pidgin, but that's a minor issue.
VLC - Media player
VLC is a handy media player that I often use over Windows Media Player. The best feature is this is a very universal player, can play pretty much any file you throw at it.
FooBar2000 - Music player
My favorite music players have been Winamp and iTunes, but recently I have been using FooBar as it's lightweight and simple to look for files. There is many plugins available for FooBar and if you're looking for the simple music player interface this is highly recommended.
CutePDF - Print to PDF
I have a love hate issue with Adobe's PDF format. I like how it's very simple to hold books but creating PDF's was an issue, if you didn't have the software there was little you could do. With CutePDF, you can print to PDF which is very handy and great for "recording" web pages or logging documents. I heavily use this for capturing e-mails or invoices that are in HTML format for archival.
Imgburn - CD DVD burner
Imgburn is very handy for create CD or DVD's plus creating ISO of physical media. The application is lightweight, offers a much simpler method than working with Nero. My only request is disabling the "successful" sound as it's annoying.
TrueCrypt - Encryption
TrueCrypt offers drive and directory encryption, plus ability to encrypt the hard drive upon bootup. Where this comes in handy is when you need to secure a directory from others, or when you need to have a laptop secured even if you loose it. It's also great to use for your USB memory sticks, and I highly recommend this be used since it locks down the file very securely.
Notepad ++ - Text editor
Using Microsoft's Notepad is handy but doesn't offer correct formatting and other tools as does Notepad ++. I really like this application and even after buying a very expensive paid version of another text editor, still use Notepad ++.
Putty - SSH client
I honestly do not know of another SSH client for Windows that is free and highly used as is Putty. I just recently switched to using SecureCRT, a paid SSH client but only after I needed a feature not included with Putty. But I really liked Putty and used it for many years.
Rich Copy - File copy utility
I've been using Microsoft's Robocopy and the add on TeraCopy but recently I found Rich Copy from Microsoft. I really like the interface of Rich Copy and the adjustments for the job which is handy for faster computers. It's also good for sync a directory or just auditing.
For now these are my favorites and will add some more shortly.
Rob
Subscribe to:
Posts (Atom)













