- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Changing userids
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
06-12-2007 05:46 AM
06-12-2007 05:46 AM
Anyone have any scripts that may help ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 06:05 AM
06-12-2007 06:05 AM
SolutionYou must remember that ownership is based on the UID number. Say my id is patrick and I want to change it to p12345. I would recommend using the 'usermod' command. I would do:
# usermod -l p12345 patrick
Now I keep the same UID, so all files that previous showed patrick as the owner now show p12345.
Now if you want to move their home directory as well, you can add the '-m' and '-d' options as well.
# usermod -l p12345 -d /home/p12345 -m patrick
That **should** change my login id from patrick to p12345 and move my home directory from /home/patrick (or whatever it was) to /home/p12345.
I would advise studying the man page for usermod as they talk about some permissions requirements when using '-m'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 06:13 AM
06-12-2007 06:13 AM
Re: Changing userids
usermod is the quickest.
If you want to farm it out to a summner intern, you could have them use SAM. It is not as efficient (and some people do not like sam at all), but it does start a background process to complete the change, and is menu driven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 06:21 AM
06-12-2007 06:21 AM
Re: Changing userids
Have a look at the manpages for 'usermod', 'chown' and 'find'. You could easily construct a script driven by a file containing the 'uid', OLDNAME and NEWNAME associations; something link:
while read UID OLDNAME NEWNAME
do
usermod -u ${UID}-l ${OLDNAME} ${NEWNAME}
find /app -user ${OLDNAME} -exec chown ${NEWNAME} {} \+
done < /tmp/users
...where the driving '/tmp/users' input might look like:
# cat /tmp/users
1000 oldmark newmark
1001 oldsam newsam
1002 userx userxprime
1003 usery useryprime
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2007 07:21 AM
06-12-2007 07:21 AM
Re: Changing userids
Beers and 10 points all around !!!!