How to Change the Owner of a Shared Folder in Linux

Situation:

Server A and Server B both mount a shared storage.

We want to change the owner of the shared storage.

Solution:

1. Create a new user in Server A and Server B.

groupadd [group name]

useradd -g [group name] [user name]

2. Check the groupId and userId of Server A and Server B. GroupId and userId on both sides must be the same.

(/etc/passwd)

[user name]:x:[uid]:[gid]::…

(/etc/group)

[group name]:x:[gid]:[user name],…

If the uid/gid is different on the servers, use vipw/vigr to modify it.

3. Change the owner of the shared storage.

Log in Server A and Server B.

chown -R [user]:[group] [shared storage]

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s