- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: change group id
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
09-08-2005 08:57 PM
09-08-2005 08:57 PM
I have to change a group id because of a nfs link, and I was testing some things.
The files belonging to the group change to the new group id, so that works fine.
There is something, I think strange, hapening with the tar files.
I make a tar with files belonging to group id, say 102. I change the group id to 120. After that the files in the tar also have group id 120.
Can someone explain this?
Regards, Alfons
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 09:04 PM
09-08-2005 09:04 PM
Re: change group id
I suspect that you are extracting the tar file whilst logged in as a user with GID 120, and since the user is not a "root" user it can only create files owned by itself.
To see the true GID of files in a tar file, preview it with: -
tar tvf file.tar
This will show you the real UID/GID's of the files. However ONLY root can extract the files correctly with the UID/GID of the files within.
You mention also NFS - remember that by default when root mounts filesystems over NFS, it actually has the permissions of the user "nobody" and NOT root, therefore has no special privileges.
If you require to do this over NFS you must export the filesystem with the norootsquash option, such that root is really root when mounted remotely.
Be VERY careful with this though as it can be dangerously insecure. When you export like this make sure you limit it to specific hosts and not *, otherwise anyone can get root access to your files quite easily.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 09:08 PM
09-08-2005 09:08 PM
Re: change group id
tar seems to archive the names of users and groups....but if you do a tar -tvf .. , it converts from names back to ids....
But stop!
That can't be. Because if you extract a tar from a foreign system and you do not have all the accounts on your system, the files will belong to UID/GID instead of names.
So I think, that tar archives the names as well as the IDs and tries to convert it, if there is a chance for it....
Micky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 09:12 PM
09-08-2005 09:12 PM
Re: change group id
I am logged in as root, and created the file as root. So the file is owned by root:sys
The files inside the tar however are assigned to group id 102.
After changing the group id 102 into 120 al the files inside the tar get group id 120.
By the way, I am not using nfs as root user.
Reagards, Alfons
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 09:14 PM
09-08-2005 09:14 PM
Re: change group id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 09:29 PM
09-08-2005 09:29 PM
Re: change group id
-rw-r----- 1 moq mtusers 1053 1.dat
-rw-r----- 1 moq mtusers 1053 2.dat
etc.
The user id of moq is 204.
The group id of mtusers is 102.
I create the tarfile as user root:
tar cvf all.tar *dat.
After that I look in the tar file:
tar tvf all.tar
and see the following:
rw-r----- 204/102 1053 1.dat
rw-r----- 204/102 1053 2.dat
etc.
With sam I change the goup id of mtusers to 120.
When i look in the tar file with
tar tvf all.tar, I see:
rw-r----- 204/120 1053 1.dat
rw-r----- 204/120 1053 2.dat
etc.
So the group id in the tar file is changed as well.
Regards, Alfons
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 09:48 PM
09-08-2005 09:48 PM
SolutionIn the POSIX format of a tar archive (the default in HPUX now), the user and group are actually stored as a string, not a numberic. You can see this if you execute: -
strings file.tar | more
You will see the word "mtusers" embedded within the file.
Therefore when you perform tar tvf, the command is reverse looking mtusers and discovering the new GID.
If you want pre-POSIX format, then you can use the O option with tar.
See the difference: -
tar cvf file1.tar *.dat
tar cvOf file2.dat *.dat
Run them both through "strings" and see the difference.
See the man page for tar for the options N and O for more details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2005 10:40 PM
09-08-2005 10:40 PM