Saturday, March 7, 2009
Thursday, March 5, 2009
Force users to change their passwords upon first login
Taken from Redhat Magazine: Tips and tricks: How do I force users to change their passwords upon first login?
- Firstly, lock the account to prevent the user from using the login until the change has been made:
# usermod -L - Change the password expiration date to 0 to ensure the user changes the password during the next login:
# chage -d 0 - To unlock the account after the change do the following:
# usermod -U
Wednesday, March 4, 2009
Adding a Directory to the Path
Adding a Directory to the Path
- To add a directory to the path of a single user is to modify that user's .bash_profile file.
- To add it to all users except user root, add it to /etc/profile.
- To also add it to the path of user root, add it to root's .bash_profile file.
Adding to a Single User's Path
To add a directory to the path of a single user, place the lines in that user's .bash_profile file.
PATH=$PATH:/data/myscriptsexport PATH
Adding to All Users' Paths (except root)
You globally set a path in /etc/profile. That setting is global for all users except user root.
PATH=$PATH:/data/myscripts
export PATH
Adding to the Path of User root
User root's path is set from scratch by its .bash_profile script. In order to add to the path of user root, modify its .bash_profile.
For more information, see the full article "Adding a Directory to the Path"
Tuesday, March 3, 2009
Reverse SSH
First thing first:
- Make sure you have installed OpenSSH on the destination machine.
- ssh -R 1234:localhost:22 home_machine (where home_machine is the IP Address of your home computer)
- Once you have established the connection, from your home type: ssh your_name@localhost -p 1234
Similar Article from HowToForge: http://www.howtoforge.com/reverse-ssh-tunneling
Sunday, March 1, 2009
Tuning LINUX Toolbox
Vmstat
Columns Information
(r,b) - How many process can be run if a CPU is available and how many are blocked.
(swpd, free, buff, cache) - Show how memory space is used.
(si, so) - Page-In and Page-Out
(io, bi, bo) - Number of Blocks received and sent to block devices
(in, cs) - Number of Interupts and context switches
(us, sy, id, wa) - Indicate percentage of time the CPU(s) has spent in userspace applications, in the kernel, being idle....
# vmstat 5 10 (To run vmstat with ten updates, five seconds )
Articles to consider:
- Monitoring Virtual Memory with vmstat by LINUX Journal
- Understanding the Linux Virtual Memory Manager by Mel Gorman
- Is swap space obsolete? by Martin Pool
Disk Performance
Hdparm is a good tool to determine whether the disks are healthy and configured
# hdparm -tT /dev/sda
Article to consider:
- Speeding up Linux Using hdparm by O'Reilly
# iostat -x sda 1
(%iowait) - High means CPU is idele and waiting for outstanding disk I/O requests.
(avgqu-sz) - Value should be less than 1
(%util) - pecentage of time the disk has requests.
To install on CentOS, Fedora, "yum install sysstat", iostat will be installed with the packages.
Articles to consider:
