Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Below is my real and effective UIDs and GIDs. My task is to implement a bash script (Ubuntu 10.10 desktop) which should auto create 3 directories rtkit, admin, pr007drdl (group names) in /home directory.

Once I have the bash script, I will create an init start/stop script, so should create directories when user logs in. I am totally new to bash scripting. Please help. Thanks in advance. I have no idea where gids' and uids' stored.

uid=10002(sandy) 
gid=119(rtkit) groups=119(rtkit),10001(admin),10003(pr007drdl)
share|improve this question

1 Answer 1

up vote 1 down vote accepted

something like that:

#!/bin/bash
sudo mkdir -p /home/{rtkit,admin,pr007drdl} #I use `-p' option to produce no error if exist
sudo chown :admin /home/admin
sudo chown :rtkir /home/rtkit
sudo chown :pr007drdl /home/pr007drdl

Group ids are stored in /etc/group . uids are stored in /etc/passwd . You can watch them with getent command. For example

getent passwd username

will return information about user username.

But I'm not sure, that you're on the right way with creating directories every system start. It's seems not like unixway (:

share|improve this answer
    
thnx for the information @Rush, This would be static. what if there's a LDAP server, with 5 clients. Say, each time Administrator creates a group on server, and the same has to be reflected on all 5 clients, with respective groups. –  nuthan Jan 17 '12 at 12:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.