- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: changing uid on many system
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
01-28-2004 04:47 AM
01-28-2004 04:47 AM
We have few hunders users and tens of systems.
We are using nis for logging. This was setup long time ago so uid was started below 100 and uid was started below 50.
We would like to change uid and gid of users. whenever I change something on nis and push the map out it is going to be problem as all the files belong to that new uid is not getting updated automatically.
What is the best way to achive this?
I have write script but that hangs and is not working proparly with nfs file system ( I actully do not want to chage anything on nfs though).
Thanks
Sachin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 05:42 AM
01-28-2004 05:42 AM
Solutionfind $4 -user $1 | xargs chown $2:$3 {}
$4 is filesystem
$1 is old uid
$2 is new uid (or just the user id)
$3 is gid (or just groupname)
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 05:59 AM
01-28-2004 05:59 AM
Re: changing uid on many system
You have a huge task in front of you. Changing uids can break the things particularly on NFS as all of a sudden you will find errors like 'permission denied' etc.,
One way is run 'find' command only once and capture enough information and then use that information to change the ownerships. ownerships.
find / |xargs ll -d > /somewhere/filelist.
If the argument list is too long, you can seperate it by filesystem wise. Then you can find the files owned by a particular user and change ownerships on only those files. I got couple of hiccups but got successful before.
Alternatively, using the common method, run find for every user.
You can use '-local' option in find to avoid changing permissions on the nfs filesystems. However, it will not stop traversing through NFS directories. The otherway is to selectively use -fsonly for both hfs and vxfs. But again there are limitations to it. Look at the man page.
find / -local -user $uid |xargs chown user:group
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 06:11 AM
01-28-2004 06:11 AM
Re: changing uid on many system
You are saying that I should use find command inside the script and use that recursively correct?
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 06:23 AM
01-28-2004 06:23 AM
Re: changing uid on many system
I would run it for each user....
I just used the $4, etc in case you want to script it.
Srindhar brings up a good point - you may want to produce a list instead - that way, is you have to go back - you can see what they were - or like he says, use that list to run the chown against:
for i in `cat filelist`
do
chown userid:group $i
done
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 06:35 AM
01-28-2004 06:35 AM
Re: changing uid on many system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 06:37 AM
01-28-2004 06:37 AM
Re: changing uid on many system
We have 100+ system and 700Tb+ space you can imagine what happens if try to do it by hand.
I have run this script on linux and hps works fine in most cases but gets hang or gets stuck in loop sometime. So far I am the test user.
Any other idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 06:45 AM
01-28-2004 06:45 AM
Re: changing uid on many system
My idea was to change one user at a time.
run script overnight on all the system by passing old uid,new uid so script will find anything that is old uid and change to new.
Then pick another user again and do same processess. I will not be able to change all at same time.
But if I finds anyother idea better thenthis I am ready to implement it.
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 08:13 AM
01-28-2004 08:13 AM
Re: changing uid on many system
You should think of this not as a uid/gid change process but a learning process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2004 09:45 AM
01-28-2004 09:45 AM
Re: changing uid on many system
I now have another eye it just make me realize that if I change one of the programmer's uid and If I can't change his files with new uid all the programm will be broken. I have to have list ready and as soon as I change uid on nis I will have to change listed files.
I fixed my script now so it is working on sun, hp and linux but not fast enough. It is taking 10 to 15 minutes per system. But If I have list of files ready It can be done within a minute.
Thanks
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2004 05:29 AM
01-29-2004 05:29 AM
Re: changing uid on many system
Now I have two script
1. goes to datacenter runs find command on local disk and finds files belong to particular user and generat a file.
Takes around 10 hours.
2. runs chown on that listed file only.
Takes less then half hour.
Thanks
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2004 05:36 AM
01-29-2004 05:36 AM
Re: changing uid on many system
A find command will touch everyfile anyway. Then why wouldn't you run it to gather the information for all the files?.
If you don't want it, then atleast you can club multiple users in one shot.
find / -local \( -user user1 -o -user user2 -o -user user3 \) |xargs ll -d >> /somewhere/list
Now list has files of user1, user2 and user3. Now you can seperate each user into a different list and have the ownerships changed. You can automate it too.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2004 05:57 AM
01-29-2004 05:57 AM
Re: changing uid on many system
I have put that provision in place so I can collect info upto three user.
But most probable it will not work because of space issue.
I have terrabyte of space with each system and only small /tmp file where I am collecting information.
I can't use other file system as they all low in space and has no uniq nameing.
Also I have to run one script for hp-sun-linux too.
Thanks for your help and ideas for pointing me in right direction.
Sachin