-2

So I gave sudo privileges to a user and I turned off root login. Now I want to edit some server configs in etc folder, but I have no permission. I can't edit the config file to turn on login to root user. What I should do?

I am using Ubuntu 20. I added sudo to user by running adduser user1 and usermod -aG sudo user1 and made keys for that user to log in without password.

Then I disabled root login and authentication in sshd_config file and give permissions to user1 with sudo chown -R user1:user1 /home/user1 and chmod 700/user1/.ssh ,but when I try to edit server files with user1 I have no permissions and if I give permissions to server files for user1 I break root sudo and get in trouble. So user1 never gets full privileges.

1
  • 3
    Please edit your question to show how you tried to edit the file(s), and the exact error message Aug 25 '21 at 15:13
1

Often on my local or when work on other computer(s) use SSH to login, then do my editing with nano.

GNU nano is a small and friendly text editor. It aims to emulate
the Pico text editor while also offering a few enhancements.

Believe is recommended for SSH to NOT enable root access from other machines, rather USERs login as themselves then use SUDO when required for root permission on other machines.

.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.