Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

What will be the sudo -i password when I only used ssh file to login?

Writer 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_address

I 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

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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy