Friday, March 2, 2012

User administration in Linux Part 2

changing file permissions

chmod has 2 formats

1.symbolic

chmod g+w filename

here the write permission to this file will be added to the group associated
with this file

chmod ug=rw filename

here all the other permission will be erased exept for the ug=rw permission


Binary number mode

chmod 754 filename
      ugo

u=user

g=group

o=other 

    
in binary the weights of the corresponding 3 places are

  _   _   _


  4   2   1


to change the user that is currently logged on

su sourav

su: switch user not super user

to make a folder with some files which can only be accessed by a particular
group

create a group 

groupadd -r IT

use some users to the group

usermod -G IT sourav



create a folder in sourav's home directory



mkdir data

see it's permission using

ls -l

by default it would be owned by user private group sourav

to the change the owner group to IT

chown sourav.IT data(need to be root foe that)

then type ls -l

the group ownership of data would be the group IT

another way of doing this

be root

type

newgrp IT

then create the directory
 mkdir database

then type ls -l

the group ownership of database will be IT

make a normal user an admin of a group(only root can do that) so that he can
add/delete any user from the group

gpasswd -A sourav IT

now sourav can add kunal to IT

gpasswd -a kunal IT

now sourav can delete someone from IT group

gpasswd -d kunal IT

verify it in /etc/group file

No comments:

Post a Comment