Do you need to install a sudo package on OpenSUSE Linux?This guide is for you.
# zypper search sudo
To get information about the sudo package, run the command below;# zypper info sudo
# zypper in sudo
# visudo
Here, ensure that the following line exists:#includedir /etc/sudoers.d
Next find and comment out the following two lines so that only users in wheel group can run sudo command:#Defaults targetpw # ask for the password of the target user i.e. root
#ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!
After this, save and close the file.# visudo -f /etc/sudoers.d/group1-users
Then add the following config information:# Allow members of group group1 to execute any command
%wheel ALL=(ALL) ALL
After this, Save and close the file by pressing ESC followed by :x.# groupadd group1
To verify it, you can use the grep command and /etc/group file as shown below:# grep ^group1 /etc/group
Then, you can add existing user named 'linuxapt' to the group1 group as follows:# usermod -aG wheel {username}
# usermod -aG wheel linuxapt
Next, verify it with the id command:id linuxapt
sudo command
sudo command arg1 arg2
sudo ls -l /etc/shadow
sudo systemctl restart nginx.service
To use root shell, simply execute:sudo -i
First, install ssh keys for vivek user in your remote/locate OpenSUSE Linux server using the ssh-copy-id command:
ssh-copy-id -i ~/.ssh/id_rsa.pub linuxapt@ln.opensuse
OR
ssh-copy-id -i ~/.ssh/id_ed25519.pub linuxapt@ln.opensuse
ssh linuxapt@ln.opensuse
sudo -i
Finally, on your OpenSUSE Linux edit the /etc/ssh/sshd_config, execute:# vi /etc/ssh/sshd_config
Then update the sshd_config file as shown below:## disable all password login including root user login ##
ChallengeResponseAuthentication no
PasswordAuthentication no
PermitRootLogin no
UsePAM no
Then restart or reload OpenSSHD service:# systemctl restart sshd.service