- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re-creating /home directories
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 07:07 AM
07-16-2007 07:07 AM
Re-creating /home directories
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 07:22 AM
07-16-2007 07:22 AM
Re: Re-creating /home directories
Depending on your objectives, you could re-populate the home directories with "virgin" copies of the files in '/usr/newconfig/etc/skel'.
You could do something like:
# for DIR in `ls /home`
> do
> cp /usr/newconfig/etc/skel/.profile /home/${DIR}
> chown ${DIR} /home/${DIR}/.profile
> done
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 07:24 AM
07-16-2007 07:24 AM
Re: Re-creating /home directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 07:26 AM
07-16-2007 07:26 AM
Re: Re-creating /home directories
>do
>cp -rR /etc/skel /home/$user
>chown $user:$(id -g $user) /home/$user/.*
>done
I am not sure if you need to recreate all the dirs, but you could get a list of user accounts on a file and cat the file like so
# for user in `cat userlist`
>do
>cp -rR /etc/skel /home/$user
>chown $user:$(id -g $user) /home/$user/.*
>done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 07:27 AM
07-16-2007 07:27 AM
Re: Re-creating /home directories
Did you not want to create the directory and . files if they are there.
Then copy the 4 . files from /usr/newconfig/etc/skel/ there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 08:12 AM
07-16-2007 08:12 AM
Re: Re-creating /home directories
Now if you already have the users added to /etc/passwd, you can write a script that extracts the HOME directory from field 6, then creates that directory, copies everything from /etc/skel and changes the ownership to that user's login name.
IFS=":"
cut -f1,4,6 -d: /etc/passwd | while read MYUSER MYGROUP MYHOME
do
mkdir $MYHOME
cp -r /etc/skel/* /etc/skel/.??* $MYHOME
chown -R $MYUSER\:$MYGROUP $MYHOME
done
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2007 11:54 PM
07-16-2007 11:54 PM
Re: Re-creating /home directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 03:30 AM
07-17-2007 03:30 AM
Re: Re-creating /home directories
Do this right and moving from box to box will become trivially easy.