Question

SSH Asking for a password for certain commands

Probably goes without saying, but I am new to DO and everything involved with it.

I was setting up my first server and set up ssh and I can successfully ssh into my server.

Perhaps I don’t yet have a firm enough grasp on SSH, but when executing certain commands, like sudo service fail2ban restart I am asked to input my password.

I was under, maybe the false, impression that when I SSH I wouldn’t need to use my password. Am I incorrect? Is it perfectly normal to be asked for your password to execute certain commands even if you are SSH-ed into the server?

Thanks for the help, I apologize for any terminology misuse.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

This question was answered by @newhosting2015:

Hi quoid. What Nixola is saying is that yes, it is normal to have to enter a password every so often when executing commands such as the one you originally mentioned ( sudo service fail2ban restart ) …I think the sudo user password is requested something like every fifteen minutes or so, as well as of course at the start of your session if you are entering a sudo command. How you are doing things is correct, in that you are using a new user with root privileges instead of using root. What Nixola was saying to you when referencing “don’t do this”, was basically saying use a sudo user and not the root account, because it is generally advised to disable the root account login after your new user has been created.

View the original comment

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.