- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Changing username and UID on HP-UX based servers
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
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
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-26-2014 09:05 AM
06-26-2014 09:05 AM
Changing username and UID on HP-UX based servers
There has been some changes in the naming convention of the user names on the Unix servers. Before usually the username was created using the first name and any UID above 100 could be assigned to it. Right now, there is some change in the naming convention and the usernames of the staff members should be the first inital and the last name. Also the UID of the staff members should be something above 20000.
I have been asked to implement these changes on the HP-UX based servers.
Can someone please advice me the best way to accomplish this task? I want to change the usernames of the existing users and also want to change the UID of these accounts as well so that they start with 20000.
Any help will be highly appreciated.
Regards,
Waqar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2014 06:04 PM - edited 06-26-2014 06:10 PM
06-26-2014 06:04 PM - edited 06-26-2014 06:10 PM
Re: Changing username and UID on HP-UX based servers
This is a trivial task if the passwd file just has a couple of users. But if you are looking at dozens or hundreds of users, the task not only very labor intensive as well as a bad idea. The task to change the login name and UID is simple. But once that is done, all the files owned by the original username will be orphans, that is, a long listing will show no onwer name but just the old UID. So all the files owned by the original UID must be changed to the new UID. For the HOME directory, this is fairly simple, but the user may have directories and files in /tmp, /var/tmp, and any number of other directories where files/directories may have this user's old UID.
To perform an accurate UID change, you my have to scan every file/directory on the system and make the change using find and -exec. For a small workstation, this may take only a minute or two, but for a large server, each UID find might take 30 to 90 minutes. During each find, the disk load will be also quite high which affects other programs and applications. Or through a good understanding of where each user's files/directories are located, yu could write selective find commands to speed things up.
This type of change can create an unstable system, especially during conversion, and unless carefully scripted, some really serious mistakes could cripple the system.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2014 05:24 AM
06-27-2014 05:24 AM
Re: Changing username and UID on HP-UX based servers
>I want to change the usernames of the existing users
This is trivial and can be done quickly. You may want to do this as phase 1.
>you may have to scan every file/directory on the system and make the change using find and -exec.
If the number of files to scan and the number of users increase, it may make sense to write a custom program or perl script to do all of the users at the same time.
I'm not sure if the chown would also be expensive, so that you might want to do that when you're in that directory.
Rather than collecting the commands and run the script later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2014 06:43 AM
07-01-2014 06:43 AM
Re: Changing username and UID on HP-UX based servers
THanks for your help. Could you please provide me a script to scan every file/directory on the system and make the change using find and -exec commands.
ANy help will be highly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2014 12:45 AM
07-04-2014 12:45 AM
Re: Changing username and UID on HP-UX based servers
>scan every file/directory on the system and make the change using find and -exec commands.
For a particular OLD_UID/NEW_UID pair you can do:
find / -user $OLD_UID -exec chown $NEW_UID {} +
If you're changing the GID too, you can tack that onto the chown.
Note: This will also attempt to change NFS files, which you might want to exclude.