Useful shortcuts for vi editor

Showing posts with label sudo. Show all posts
Showing posts with label sudo. Show all posts

Wednesday 13 July 2022

How to add a user into "wheel" group?

For example, you have only a root user for the super-user activities, but you wanted to use a custom user for some specific purposes. To make this, you might use "wheel" user group which is a special one for the "sudo" operations. 

Action
sudo usermod -aG wheel alperadm

Check and Determine the Option:
$ sudo cat /etc/sudoers

## Allows people in group wheel to run all commands
# %wheel  ALL=(ALL)       ALL

## Same thing without a password
%wheel        ALL=(ALL)       NOPASSWD: ALL

$ cat /etc/group | grep wheel
wheel:x:10:root,alperadm

Test
$ cat /etc/sudoers
cat: /etc/sudoers: Permission denied

$ sudo cat /etc/sudoers
Worked!

Wednesday 19 December 2018

What are the differences of su/ su -/ sudo / sudo su in linux system?

Info: 
su means, switch user or substitute user
sudo means, super user do
to use sudo command, related user must be defined in sudoers file

$ su -
(switch user to root then executes all /etc/profile, .profile and .bashrc files by root)

$ su
(switch user to root user then executes only .bashrc file by root)

$ sudo su -
(switch user to root then executes all /etc/profile, .profile and .bashrc files by root if current user defined in sudoers file)

$ sudo su
(switch user to root then executes only .bashrc file by root if current user defined in sudoers file)

Ref: https://ozsoyler.blogspot.com/2016/09/how-to-gain-root-access-without_15.html

Thursday 15 September 2016

How to gain root access without entering root password on Linux?

Add the line into the end of /etc/sudoers file as root
vi /etc/sudoers
alper ALL=(ALL) NOPASSWD: ALL

Test your connection
ssh alper@10.10.10.10
$ sudo su -
(executes all /etc/profile, .profile and .bashrc files)
# ifconfig
$ sudo su
(executes only .bashrc file)
# ifconfig

References: