What will be the sudo -i password when I only used ssh file to login?
Andrew Mclaughlin
I don't know if anyone would understand from title, but I couldn't summarize it.
So, I am using ssh file when logging in to my server, like this:
ssh -i/path/to/file root@ip_addressI want to disable direct root access and use another user while logging in to my server and use sudo -i to switch to the root user.
I don't have that much experience with servers nor ubuntu, but last time I used ubuntu, I didn't use any kind of file while connecting to the server, I just wrote ssh user@ip_address and was using sudo -i to switch on the root access.
I am wondering, if I were to disable direct root access, what password will I use when I run the sudo -i command. Because the ssh file is on my computer, and I won't be able to access it from the server, so there should be some other password to use.
1 Answer
You should type the password of the user you are logging as. It doesn't matter that you did login using the ssh key. When you created that user account you probably set some password for it (or, if you didn't, you should do this now). You must use that password for sudo.
Or, you can add the following line to the /etc/sudoers file (it's best to edit this file using the visudo command which guarantees that the system will properly apply changes):
youruser ALL = NOPASSWD: ALL
where youruser is the username you use to login. This allows youruser to use sudo without typing any password.