We have just deployed a couple of Linux server. Each sysadmin will have his own account on the server (i.e.: jsmith), and will connect using SSH with a certificate which will be put into the "authorized_keys" file in their home directory. Once connected on the server, if they want to issue an elevated command, they will do like:
sudo ifconfig
They will then enter the root password.
What I would like to know now are the best practices in managing that root password. Should I change it periodicaly? And how do I share that new password with the sysadmins?
**Of course I will disable the root logon in SSH.
If they are using sudo, then it will ask for their password and not root password, therefore no root password change needed. Just be sure to give them proper privileges in /etc/sudoers file.
You don't need to worry about root password when using sudo. Perhaps, I would recommend to disable root password by issuing
Although, before you do that, make sure that you've a relevant system user with all the privileges.
You can always get root console by issuing
Following is a small script I use to provision my servers.
You may modify if according to your needs. Make it interactive, use a user vairable etc. :)
Enjoy!
There is one condition where you actually need the root password: if a filesystem is fails fsck when booting, you will typically be prompted to enter the root password to obtain a shell prompt where you can repair the damage. At that point, neither regular user accounts nor SSH will be available. If the sysadmin doesn't know the root password, then the only other option would be to boot from alternate media.
According to best practices:
Ssh login with root user should be forbidden
/etc/ssh/sshd_config comment the following line:
PermitRootLogin yes
Create a group and put all sysadmins users in it
groupadd <sysadm_group>
groupmod -A <user1>,<user2> <sysadm_group>
edit /etc/sudoers file.
visudo
Add at the bottom:
%<sysadm_group> ALL=(ALL) ALL
Root password should be stored on secure location, and used only in emergency situations.
My Notes about sudo: (PLEASE NOTE - my notes are just my collection from our very own google only. i post them because it may help newbies, slow-learners like me;).. if you say the info isnt correct, or just a copy from wiki, or plagiarism, blah blah blah, then let me know thru a comment, i would be very happy to delete my post, than your down-votes )
From wiki page:
From man page:
To get a file listing of an unreadable directory:
% sudo ls /usr/local/protected
To list the home directory of user yazza on a machine where the filesystem holding ~yazza is not exported as root:
% sudo -u yazza ls ~yazza
To edit the index.html file as user www:
% sudo -u www vi ~www/htdocs/index.html
To shutdown a machine:
% sudo shutdown -r +15 "quick reboot"
FAQ and Troubleshooting Tips
http://www.sudo.ws/sudo/troubleshooting.html