Solaris 10 Zone Administration.


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris 10 Zone Administration.
# 1  
Old 09-18-2008
Solaris 10 Zone Administration.

Hey now!

I am new to Solaris 10 (at least to using Zones on it)

I have just been handed a bunch of servers with zones already created. and I am adding users, setting up .bash_profile and .bashrc scripts.

Does anyone know a way to do things like user adds on all the non-global zones at once? Is this possible? Or do i have to log into each zone as if it were a separate server?

Also, as far as the .bashrc, I know I can propagate it to each user's /home directory, but then I have to do a chown on each one afterward. Is there any way I can place it into the user's /home directory and take on that users ownerships?

I have played around using for loops to reach down into the zones to gather information, as in the for loop below, but executing commands and chowning files adds more complexity than I am comfortable with as far as scripting goes:

# for i in `ls /export/home/zones`
> do
> zlogin $i hostname
> zlogin $i ifconfig -a
> done

thanks in advance!

-Bob
# 2  
Old 09-18-2008
Set-up a NIS or LDAP server and have the accounts created on it.
Set-up an NFS server and have the user's home directories automounted there.

That's it !
# 3  
Old 09-18-2008
If you are adding individual users to individual hosts (ie: not using NIS/LDAP/AD), you should consider adding common home directory files to the skeleton directory. When running useradd, remember that there is a flag to copy the skeleton 'stuff' to the user's home directory.

From "man useradd"
Code:
useradd  [-c comment] [-d dir] [-e expire] [-f inactive]
     [-g group] [-G group [, group...]] [-m [-k skel_dir]]
     [-u uid [-o]] [-s shell] [-A authorization  [,authorization...]]
     [-P profile  [,profile...]] [-R role  [,role...]]
     [-p projname] [-K key=value] login

Look for:
Code:
     -k skel_dir

         A directory that contains skeleton information (such  as
         .profile)  that  can  be  copied  into a new user's home
         directory. This directory must already exist. The system
         provides  the  /etc/skel  directory that can be used for
         this purpose.

     -m

         Create the new user's home  directory  if  it  does  not
         already  exist. If the directory already exists, it must
         have read, write,  and  execute  permissions  by  group,
         where group is the user's primary group.

pick a place for your skeleton directory that you can easily propagate to your various hosts (rsync/nfs/scp), then when you create new users, they will have the common .bashrc file (and others that you identify)
# 4  
Old 09-19-2008
Avronius,

thanks, /etc/skel is a good option for me. One question though. I don't mind if the user owns their .bashrc, but I want root to own .bash_profile upon user creation. If I put .bash_profile into /etc/skel, it will be woned by the user.

I am wondering if I make it a link in /etc/skel will it propagate as a link upon user creation? Or will I cause some damage by putting a link in /etc/skel?
# 5  
Old 09-22-2008
I answered my own question:

# ls -al /etc/skel
total 12
drwxr-xr-x 2 root sys 512 Sep 19 22:24 .
drwxr-xr-x 68 root sys 4608 Sep 18 13:44 ..
lrwxrwxrwx 1 root root 14 Sep 19 22:23 .bash_profile -> /.bash_profile
-rw-r--r-- 1 root root 44 Sep 19 22:24 .bashrc
-rw-r--r-- 1 root other 144 Jan 21 2005 .profile
-rw-r--r-- 1 root sys 136 Jan 21 2005 local.cshrc
-rw-r--r-- 1 root sys 157 Jan 21 2005 local.login
-rw-r--r-- 1 root sys 174 Jan 21 2005 local.profile
# ls -al /export/home/mylogin
total 9
drwxr-xr-x 2 mylogin admin 512 Sep 18 15:04 .
drwxr-xr-x 13 root root 512 Sep 18 13:42 ..
-rw------- 1 mylogin admin 141 Sep 20 10:12 .bash_history
lrwxrwxrwx 1 root root 14 Sep 18 14:02 .bash_profile -> /.bash_profile
-rw-r--r-- 1 root root 44 Sep 18 14:03 .bashrc
-rw-r--r-- 1 mylogin admin 144 Sep 18 13:42 .profile
-rw-r--r-- 1 mylogin admin 136 Sep 18 13:42 local.cshrc
-rw-r--r-- 1 mylogin admin 157 Sep 18 13:42 local.login
-rw-r--r-- 1 mylogin admin 174 Sep 18 13:42 local.profile
#

creating a link inside /etc/skel will create a link in my home directory upon user creation.
# 6  
Old 09-22-2008
oops! Not sure how this is happening, but now whenever I do a useradd, the .bash_profile inder root takes on the ownerships of the user I just created. not a catastrophe, but rather annoying.
# 7  
Old 09-22-2008
I would say what you observe is the expected behavior. The useradd command is doing a chown on the newly created files which propagates to the symlinked root .bash_profile in your special case.

Have a look at line 81 of Cross Reference: /onnv/onnv-gate/usr/src/cmd/oamuser/user/homedir.c
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Solaris 11 zone has no external network access (except to Global Zone)

Hi, hoping someone can help, its been a while since I used Solaris. After creating a NGZ (non global zone), the NGZ can access the GZ (Global Zone) and the GZ can access the NGZ (using ssh, zlogin) However, the NGZ cannot access any other netwqork devices, it can't even see the default router ... (2 Replies)
Discussion started by: GazinLincoln
2 Replies

2. Solaris

Solaris 11 Global zone patching having Solaris 10 branded zone

I am planning to do solaris 11 global zone patching having solaris 10 branded zone. I have a doubts on step 8 specially Can someone clear my step 8 doubts or if anything wrong between step 1 to step 9 please correct that also as I have pretty good idea about Step 10 mean patching in solaris 10... (2 Replies)
Discussion started by: amity
2 Replies

3. UNIX for Advanced & Expert Users

Solaris 10: I forgot to detach a zone before zpool export. Uninstall zone?

Dear all, recently, I migrated a solaris zone from one host to another. The zone was inside of a zpool. The zpool cotains two volumes. I did the following: host1: $ zlogin zone1 shutdown -y -g0 -i0 #Zone status changes from running to installed $ zpool export zone1 host2: $ zpool... (2 Replies)
Discussion started by: custos
2 Replies

4. Solaris

Solaris 10 local zone on Solaris 11 global zone

Hi, A quick question: Can Solaris 10 local zones be moved to a Solaris 11 global zone and work well? Thank you in advance! (5 Replies)
Discussion started by: aixlover
5 Replies

5. Solaris

Zone administration

hi frnds I created sparse root zone, in that zone when i try to change the passwd it is giving permission denied. what is the reason and how to chnage the root passwd in the zone. can u please explain the query. (4 Replies)
Discussion started by: sravan ega
4 Replies

6. Solaris

Solaris User Administration

Hi All..... How many maximum no of users can be created in solaris 10.0 Waiting for the reply ..... (2 Replies)
Discussion started by: sendhils13
2 Replies

7. Solaris

Solaris Zone : Non global Zone check failed

Hi All , I try to install some packages in my global zone... On the execution of the installion of the script it quits by saying the error "Non global zone check failed" Kindly help me in this regard Thanks in advance, jeganr (7 Replies)
Discussion started by: jegaraman
7 Replies

8. UNIX for Dummies Questions & Answers

solaris administration book

hi can anyone give me a link of Solaris administration book (solaris 10). Regards Rochit (1 Reply)
Discussion started by: rochitsharma
1 Replies
Login or Register to Ask a Question