How can I log in as 'root' on my server?
By default, you cannot log in to your server remotely using "root." You must first login with your setup User ID and then change the logged in user to "root". If you need "root" access on your server, you have two options. You can use the su - command once you have logged in with your User ID, to switch to root access. Alternatively, you can login your USER ID, switch users as mentioned above, and then modify the sshd_config file to permit root access upon the initial login, without having to change users in each time you require root access.
Some of the information in this article is advanced material we make available as a courtesy. Please be advised that you are responsible for properly following the procedures below. Customer Support cannot assist with these topics.
To Login and Change to use the su - Command
The su
(short for substitute user) command makes it possible to log in as root temporarily while you are logged in with your normal User ID.
- Log in to your server with your regular user account.
- Type:
su -
- Enter your root password. Your root password is the same as the password for your normal User ID.
To Allow Root User Access Upon Login, Modify the sshd_config File to Permit Root Access
- Log in to your server and switch to root using the
su -
command. - Using an editor, edit
/etc/ssh/sshd_config
. - Locate the line:
PermitRootLogin noThen edit it to read:PermitRootLogin yes
- Locate the line:
DenyUsers rootThen edit it to read:#DenyUsers root
- Locate the line:
DenyGroups rootThen edit it to read:#DenyGroups root
- Save the file.
- Restart SSH by issuing the following command:
/etc/init.d/sshd restart