(B15) Linux Admin part15 User Management 3 - switch user su, suders, sudo

Published: 24 March 2022
on channel: Latif Shaik
34
0

20220324 120454
if a normal user , require to do a admin task

suders

user management

switch user - su

pwd
/tmp

su - -- switch to root with root user's home dir

pwd
/root

pwd
/tmp

su --switch to root user , pwd is not changing

pwd
/tmp
-----------------
pwd
/tmp

su - student1 -switch to student1 user, pwd change to student1 home dir

pwd
/home/student1

pwd
/tmp

su student2 -switch to stundent2 user, pwd not changes

pwd
/tmp
-----------------------------
[student15a@cts15l1 ~]$ useradd user5
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.

[student15a@cts15l1 ~]$ su -
Password:
Last login: Thu Mar 24 11:19:11 IST 2022 on :0
[root@cts15l1 ~]# less /etc/passwd
[root@cts15l1 ~]# useradd user4
[root@cts15l1 ~]# passwd user4
Changing password for user user4.
New password:
BAD PASSWORD: The password is shorter than 7 characters
Retype new password:
passwd: all authentication tokens updated successfully.

[root@cts15l1 ~]# less /etc/passwd
-----------------------------------------------
if you dont root password?
root is administrator
your not ,
how to become administrator?

how to do admin cmds by normal user?

if user is sudoer then user can run admin cmds

root:

1. add user to wheel group
id student15a

usermod -a -G wheel student15a

id student15a

2. vi /etc/sudoers
remove # before %wheel

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

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

3.exit from user and login again

4. sudo useradd user5

sudo passwd user5

!!confirms your sudoers .....


sudo - do as super user
-like run as administrator

super user is root
---------------------------------------


Watch video (B15) Linux Admin part15 User Management 3 - switch user su, suders, sudo online without registration, duration hours minute second in high quality. This video was added by user Latif Shaik 24 March 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 34 once and liked it 0 people.