Day2 Linux
Day2 Linux
1- Navigation pwd cd
51 pwd (Print work directory)
53 cd /home
67 cd ..
68 pwd
69 cd /home/hany/Desktop/
70 cd ../../..
72 cd /home/
73 cd /etc
74 pwd
75 cd -
76 cd /etc/security/
77 cd ~ <<<<<<<<< telda = home directory
---------------------------------------------------------------------------
2- listing files and directories
ls -l
sales1 sales others report1
rwx rw- r--
sales2 sales
sales3 sales
hr1 hr
it1 it
sysadmin it,sales,hr perm ?? rw-
-listing users:
gedit /etc/passwd
root:x:0:0:root:/root:/bin/bash
hany:x:1000:1000:hany:/home/hany:/bin/bash
username:x:UID:GID:comment:HomeDirectory:DefaultShell
--------------------------------------
create user
useradd ahmed
useradd -s /bin/sh -u 1005 -c "sales manager" khaled (-s Shell, -u User ID, -c
Comment)
useradd username
--------------------------------------
modify user
usermod
[root@Server1 ~]# gedit /etc/passwd
[root@Server1 ~]# usermod -s /bin/bash khaled
[root@Server1 ~]# usermod -c "Hr Manager" khaled
[root@Server1 ~]# usermod -u 1006 khaled
[root@Server1 ~]# usermod -l k.mostafa khaled (-l login name)
[root@Server1 ~]# id khaled
--------------------------------------
criat Password:
passwd userNameuser
---------------------------------------
swich user
su akhater
-------------------------------------------
remove ususerer
[root@Server1 ~]# userdel ahmed
[root@Server1 ~]# userdel -r k.mostafa (-r deleted every thing)
---------------------------------------------------------------------
group administration
user member of 1 primary group , secondry groups ....
sales1 sales,stuff,all
sales2 sales
it1 stuff,sales
rwx rwx r--
sales1 sales others
it1 stuff
----------------------------------------------------------------------
- create group
groupadd sales
-----------------------------
- modify group members
change primary group for user
#usermod -g primaryGroupName userName (-g to change primary group)
change secondry group for user
#usermod -G SecondaryGroup Username (-G to repls secondary guop)
add user to another secondary group
#usermod -a -G SecondaryGroup Username (-a -G to add user to another
secondary group)
---------------------------------------------------------------
- remove group
#groupdel GroupName