• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Resolved SSH no sudoers right

Fixel

New Pleskian
Hi everyone,

sorry for my newbie question... Its more linux than plesk, but i hope you guys can help me!

I set up my new Server with Plesk on top of it, to make it more secure, i denied root ssh login. And allowed only one user to login via ssh.

Now I recognized, that the only user which can login over SSH has no right to perform sudo commands. I forgot the entry in the sudoers file! :(

My hope is to get it running any how by using the Plesk interface. I saw that It's possible to perform a command as root.

Is it possible to get my user into the sudoers with this solution? I already tried that:

Code:
echo "myuser ALL=(ALL:ALL) ALL">>/etc/sudoers

But it didn't work after restart.

Are there any ideas or solutions?

Thanks in advance.

Felix
 
Hello, you can try to add sudo rights to your user by adding a cronjob woth the task manager as root.

But in my opinion, allow only ssh access for root with ssh keys and a custom ssh port should provide a good level of security without risking to loose access to your server
 
Hello, you can try to add sudo rights to your user by adding a cronjob woth the task manager as root.

I already configured a cronjob filled with the command above and executed it as root. No errors, but after a reboot I still couldn't sudo. Any ideas why this didn't work? I tried it on an other machine, the entry in the file was made succesfully at the bottom.

Are there any other commands which I can use to give this user the permission to execute sudo again?

But in my opinion, allow only ssh access for root with ssh keys and a custom ssh port should provide a good level of security without risking to loose access to your server

I already configured a custom ssh port. I didn't use a ssh key so far, because I wanted to stay flexable, so I can still access it from everywhere.

But I will think about it. Thank you for the advice.
 
I already configured a cronjob filled with the command above and executed it as root. No errors, but after a reboot I still couldn't sudo. Any ideas why this didn't work? I tried it on an other machine, the entry in the file was made succesfully at the bottom.

Are there any other commands which I can use to give this user the permission to execute sudo again?



I already configured a custom ssh port. I didn't use a ssh key so far, because I wanted to stay flexable, so I can still access it from everywhere.

But I will think about it. Thank you for the advice.

The cronjob used was :
Code:
 sudo adduser your_user sudo
?

Otherwise you can try to replace your sshd_config file and to restart ssh service.
I have posted the default sshd_config (with root login allowed) for ubuntu on gist.github.com : default sshd config ubuntu · GitHub

So you can create a cronjob :
Code:
wget https://gist.githubusercontent.com/VirtuBox/a2a98d9f195f38c2b17dee80a8f124d2/raw/29bfb405fdb835b5106b44aa0d3200c715240c0b/sshd_config -O /etc/ssh/sshd_config && systemctl restart ssh
 
Well, thank you very much!

I tried to execute this
Code:
echo "myuser ALL=(ALL:ALL) ALL">>/etc/sudoers
to add the user manually to the file.

Didn't know there is a group for all sudo users! Need to learn more about Linux!

again, thank you, you saved me!:rolleyes:
 
Hi

After following the thread and the instructions therein,

I got the error

/bin/bash: /etc/sudoers permission denied

Fyi(trying to deploy a react application)(tried deploying the build folder at httpdocs (failed) trying now to deploy using the terminal on ubuntu 20.04 but can't sudo )

Any help would be greatly appreciated.

Thank you
 

Attachments

  • plesk_error.png
    plesk_error.png
    35 KB · Views: 9
Back
Top