Notably, it lets you have timeouts for the auth (password must be re-entered, not true for ssh sessions), it lets you have password minimums and rotation (unlike ssh keys, which have a passphrase outside the server's control). Requiring a password for privileged commands has a couple of nice benefits that private key SSH doesn't. To do so you need to edit the /etc/sudoers sudo configuration command using the sudo visudo editor. The /usr/bin/apt update makes adding an option first like sudo apt -q update passwordless. Configure sudo without password on Ubuntu 20.04 step by step instructions First you might want to consider to disable sudo password only for a selected administrative command (s). The /usr/bin/apt update makes the basic command sudo apt update passwordless. If you really want, there may be tricks you can do with a suid program that checks the sshd log and locks/edits the sudoers file to let that user do a no-password sudo, and a periodic task to revoke this permission.Īll that said, I think this is a bad idea. The most robust way that I can see to do this is: sudo ALL (root) NOPASSWD: /usr/bin/apt update, /usr/bin/apt update, /usr/bin/apt update. ![]() You can do that by changing the /etc/sudoers file via the sudo visudo editor. 3 Answers Sorted by: 357 Use the NOPASSWD directive You can use the NOPASSWD directive in your /etc/sudoers file. ![]() Sudo doesn't know about login methods, and ssh doesn't publish to other programs anything that would indicate whether public key, password, or some other mechanism was used for login.Īs someone else said, you can use the NOPASSWD option in sudoers - this would apply to specified users always, though, not only when they use ssh with private keys. How to Run the sudo Commands Without Entering a Password on Ubuntu 20.04 Since disabling passwords for commands that require sudo is not recommended, you may want to apply that to only a specific command. This is not possible without some serious code changes to sudo and sshd.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |