Ubuntu – Making files generally available on Linux system (when security is relatively unimportant)

9.10filesystemSecurity

I am using Ubuntu 9.10 on a stationary PC. I have a secondary 1 TB harddrive with a single big logical partition (currently formatted as ext4). It is mounted as /usr3 with options user, exec in /etc/fstab.

I am doing highspeed imaging experiments. Well, only 260fps, but that still creates many individual files since each frames is saved as one png-file. The stationary is not used by anyone other than me which is why the default security model posed by ubuntu is not necessary.

What is the best way to make the entire contents of /usr3 generally available on all systems. In case I need to move the harddrive to another Ubuntu 9.x or 10.x machine?

When grabbing image with the firewire camera I use a selfmade grabbing software-utility (console based) in sudo-mode. This creates all files with root as owner and group.

I am logged in as user otb and usually I do the following when having to make files generally available to otb:

sudo chown otb -R *
sudo chgrp otb -R *
sudo chmod a=rwx -R *

This takes some time since the disk now contains individual ~200000 files.

After this, how would linux behave if I moved the harddrive to another system where the user otb is also available? Would the files still be accessible without sudo use?

Best Answer

You will need to have same uid and gid for the user otb (or whatever the username is) in order to be able to access the files without sudo on a different system.

UID (user ID) and GID (group ID) are both unique number systems assigned to users and groups. For normal users they start from 1001 onwards.

Easiest way to ensure same permissions: In the file /etc/passwd, for any user entry, UID & GID is the third and fourth field respectively. On second system you can create a user with command from a terminal using useradd -u UID -g GID username where the UID and GID are the same UID and GID of the user otb in first system. Before issuing the command, ensure that the same UID is already not in use.

I tried from GUI System -> Administration -> Users and Groups and could not find a way to synchronize it.

Keeping same /etc/passwd file across systems, or using solutions like NIS, LDAP will make this much more smoother if you have more systems.

For more details refer to man useradd, man usermod and, if you need to delete any users, man userdel from a terminal.