LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-22-2012, 05:32 PM   #1
shva
Member
 
Registered: Feb 2009
Distribution: Fedora, Arch, Debian, Ubuntu
Posts: 56

Rep: Reputation: 15
Permission problem in a shared partition among several Linux OSes


I have a Ubuntu and a Scientific Linux installed on the same computer so that I can switch back and forth, and I intend to use a third partition to host the common files. For example, I mount this partition as /common_files in both systems. However, each time I change from one system to the other, I am no longer the owner of /common_files. So I have to do

Code:
sudo chown -R myname: /common_files
to change the ownership. How can I avoid doing that?

Note that the username for both Ubuntu and Scientific Linux is "myname". I just want to keep the ownership of /common_files on both systems. Thanks.
 
Old 07-22-2012, 05:44 PM   #2
fogpipe
Member
 
Registered: Mar 2011
Distribution: Slackware 64 -current,
Posts: 550

Rep: Reputation: 196Reputation: 196
I have a shared /home partition and at any given time at least two bootable linux distros and when i run into that problem i use
Code:
chown -R myusername.myusergroup /home/myusername
This will work if your user name is the same on all the distros that you boot and if there is a group named for your user name.

For instance if your user is hal:

Code:
chown -R hal.hal $PATHTODIR
If you dont have a group on all the distros you boot to that is named after your username you will have to create that group using groupadd.
Code:
man groupadd

Last edited by fogpipe; 07-22-2012 at 05:45 PM.
 
Old 07-22-2012, 07:17 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,329

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
Ownerships are actually done by uid (see /etc/passwd), not username.
SL starts normal users at uid=500, Ubuntu at uid=1000 http://manpages.ubuntu.com/manpages/...er.conf.5.html http://scientificlinuxforum.org/inde...showtopic=1640
(SL is based off RHEL)
 
Old 07-22-2012, 07:25 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
To expand on chrism's post:

Linux does ownership by user ID, not user name. Your user IDs are different on the two machines, so when you boot one or the other, they don't recognize the UID from the other system. You need to change the UID for your username on one of the systems to match the other. If you log out, and access a terminal through Ctrl + Alt + F2-6 and log in as root, you should be able to change the UID for your username to whatever you want. You should probably do this in SL, because changing your UID in SL from 500 to 1000 is safe, changing your UID from 1000 to 500 in Ubuntu is not (1-999 in Ubuntu is reserved for system).

Code:
id username # write down the UID and GID for your user, from here on out this will be referred to as oldUID and oldGID
usermod -u newUID "username"
groupmod -g newGID "groupname"
find / -user oldUID -exec chown newUID {} \;
find / -group oldGID -exec chgrp newGID {} \;

Last edited by suicidaleggroll; 07-22-2012 at 07:26 PM.
 
1 members found this post helpful.
Old 07-22-2012, 09:32 PM   #5
shva
Member
 
Registered: Feb 2009
Distribution: Fedora, Arch, Debian, Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Thanks guys. After changing the user id and group id in Scientific Linux to the one used in Ubuntu, the problem is resolved.
 
Old 07-22-2012, 09:51 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,329

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
Good; FYI, this also applies to NFS ie server & client must use same uids.
 
  


Reply

Tags
permission


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
samba shared win box partition permission denied matters Slackware 8 04-11-2009 03:22 AM
File visibility problem in Linux / Windows shared FAT32 partition dineshshah Linux - General 2 01-03-2006 09:13 PM
Shared partition and user write permission dashnaam Linux - General 3 07-10-2005 02:22 PM
Permission problems in a vfat shared partition ReachingFarr Linux - Newbie 4 10-04-2004 08:09 AM
Win/Linux shared partition permission problems Ice Dragon Linux - Newbie 3 03-19-2004 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration