new partition on external drive - permissions: root drwxr-xr-x

Hi

I tried two times to make an new partition (after the FAT partition on it) on my external hard drive with YaST>Partitioner.

Fist I had tried ext3 now I have ext2 on it.
Both times the partition (or the corresponding folder in /media) was only writeable to the superuser/root but not to a normal user (readable to the normal user). Root is the owner.

The FAT-Partition on the same external drive is owned by the normal user who was logged in as I plugged the USB-cable in.

I can unmount both partitions als normal user in natilus.

  1. Can I start nautilus as root to change the permissions?
  2. What have I done wrong? Should I use an SuSE Live-CD or an CD with an special partitioning-program instead?

Greetings
pistazienfresser


Now I am using (on my Samsung X20) openSuse 11.1 and Gnome 2.24.1 (mostly, 1 account is using KDE) and Kernel Linux 2.6.27.45-01.1-pae. “/home” is on an separated partition (as part of an extended partition). I have also 2 NTFS partitions for Windows XP (System and Data), and a FAT, a root (/) and a swarp partition.

I have an other laptop on that I have installed 11.2 a few days ago.

Linux filesystems have real ownership info as compared to FAT filesystems where the ownership info is faked up from the mount option. Therefore if you want the partition to be writable to users, the top directory and the mountpoint must be owned by the user or writable to the user.

If you just want a user to be able to put files in a directory in the partition, simplest way is to mkdir a subdirectory, then chown it to the user. Thereafter, the user can do what they like underneath that subdirectory.

Thanks ken_yap!

Is the owner of this ext2 file system every root/superuser of the linux I have plugged the external drive in? Or is it only the root of the linux I have made this partition with?

That root is the owner of an new file system may be so. But why can I only make an new file system also only “writable only by the owner” by default. Is this necessary, too?

Is there an easy way to do this? Is /media/disk-40 the top directory or the moutpoint?

Can I also run a graphical program as su to do this?

If I want more users/more users on more systems to be able to write: should I leave the ownership to root but chmod/change the writing ability to the user-group?

Can/Should I make me an user with sudo-abilities to do things like that in an graphic way? Or would the sodoer not be able to do (some) things like that?

Greetings pistazienfresser

P. S.:

SDB:Basics of partitions, filesystems, mount points - openSUSE

When a the partition to be mounted has a label (e.g. Backup), it will use that label and will mount at /media/Backup/. When there is no label it will mount using the device type as a name and thus mount at /media/cdrom/ or /media/disk/. It will add numbers to avoid double names (/media/disk-1).

How to I add a label to my partition? “disk-1” - “disk-40” seems not perfect to me :wink:

Greetings
pistazienfresser

Read

man tune2fs

for ext2/3

or

man reiserfstune

for reiserfs (suprise, surprise).

Thanks.
Do you mean this?:

NAME
       tune2fs - adjust tunable filesystem parameters on ext2/ext3 filesystems

SYNOPSIS
       tune2fs  -l ]  -c max-mount-counts ]  -e errors-behavior ]  -f ]  
       -i  interval-between-checks  ]    -j  ]    -J  journal-options ]  -m
       reserved-blocks-percentage  ]    -o  ^]mount-options,...]   ]    -r
       reserved-blocks-count ]  -s sparse-super-flag ]  -u user ]  -g group
       ]  -C mount-count ]  -E extended-options ]  -L volume-name  ]    -M
       last-mounted-directory  ]    -O  ^]feature,...]   ]   -T time-last-
       checked ]  -U UUID ] device

DESCRIPTION
       tune2fs allows the  system  administrator  to  adjust  various  tunable
       filesystem parameters on Linux ext2/ext3 filesystems.

OPTIONS

…]

 -L volume-label
              Set  the volume label of the filesystem.  Ext2 filesystem labels
              can be at most 16 characters long;  if  volume-label  is  longer
              than  16  characters, tune2fs will truncate it and print a warn-
              ing.  The volume label can be used  by  mount(8),  fsck(8),  and
              /etc/fstab(5)  (and  possibly  others)  by specifying LABEL=vol-
              ume_label instead of a block special device name like /dev/hda5.

so?:
1.a9 log in with F2+Control+UP as “root”
OR b) UserNomal>Gnome>GnomeTerminal>su+passwordSU
2.

cd /media/disk-40
tune2fs -L external_ext2

a) F7+Control+UP OR b) [exit AND exit]

Is there also something for setting the partition as writeable for all users by default?

Greetings
pistazienfresser

Is there also something for setting the partition as writeable for all users by default?

Permissions are given when you mount it.

See mount command

The volume is mounted by default when I plug it in the USB. That’s fine.

In the man mount pages I found only:

-w     Mount the file system read/write. This is the default. A synonym
              is -o rw.

...]
users
    Allow every user to mount and unmount the file system. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid). 



Same under: mount - Linux Command - Unix Command and mount(8): mount file system - Linux man page

I think -w is only about writing for the owner (root) not for every user.

So I do not know what I should write in fstab.
I do not want to change any permissions in the folders on this partition.

If there is no other pragmatical way I will do so:
new partition on external drive - permissions: root drwxr-xr-x - openSUSE Forums

But will this work still if I plug the external drive in an other Computer or simply make an new installation of my operating system on the same Computer?

pistazienfresser

The account UIDs of the owners of the files would have to stay unchanged for this to work.

Thanks.

User identifier - Wikipedia, the free encyclopedia

So only “1000”-“1003” or also the Login and the Name as shown under GNOME>YaST>User and Group Administration (I made a screen shot)? Have the passwords also to be the same?

Greetings pistazienfresser

No, obviously. The filesystem only stores the UIDs and GIDs, and permissions, for each file or directory.

Thanks for answering my endless questions again!

I.
That’s fine for me and making an backup of my actual user data. (But so: It is [more or less] easy to get access to an users data without the original user’s or root’s password. If you want to prevent this you have to use an encrypted partition or to encrypt the special data.)

Thanks
pistazienfresser

Only user/group ids (the numbers) are in the entries on the file system. The user/group names are ‘only’ an easy way to reference them. The connection between the two is in /etc/passwd and /etc/group. These can be (and mostly are) different on different systems. Thus it is important to have your user administration the same on systems that are organisational strongly linked This is not only true for file systems that are switched between systems, but also for remote mounted file systems (NFS). This being prone to errors, tools like NIS for central administration have been invented.

I may be wrong, but I have the idea that you do not quite see what the properties from a file system and the files on it are and what the properties of the mount point (and other system parameters like user administration) are and how they work together (or not).

Reading SDB:Basics of partitions, filesystems, mount points - openSUSE may help.

If you have access to the backup media, all bets are off, unless the data is encrypted.

Back in the days of magtape I got access to some normally protected files because I could mount the magtape and read off somebody else’s files as myself.

I.

You may be right. But also I may have asked again as I have been being aware that I have not worked with that things enough to be sure about my understanding and not understanding.

II.

I think it is not likely this link would do damage to me or anyone else reading this thread. Thanks!

II.
So to test if I have an rough understanding:
If I want a way to share data (including big files) easyly between different linux/GNU systems:

  1. I make/take an external drive with an ext3 partition on it.
  2. I create an folder/directory “exchange” on this ext3 partition with owner root (UID=0 in all unix-like-systems).
  3. Change the permissions (with chmod) for that folder “exchange” to 666(=rw- rw- rw-) [or even to 766(=rwx rw- rw-)?].
    [4. Changing the group of the folder “exchange” to “users” with “chgrp” will not work for exchanging with Red Hat/Fedora as they do not know/work with a group “users”?]

III.
But a FAT32 Partition can be mounted so that all users have access to it all by default: SDB:Mount a DOS partition with all permissions for users - openSUSE
(maybe because FAT cannot contain any user data??).

Greetings
pistazienfresser

You are pretty near. Btw Just call them directories, folders is something from the desktop metaphore I believe. :wink:

on 1). Yes you can, I have an USB card and done the same.

on 2), yes, we all may be happy that uid 0 is the root user (and called root on all the Unix/Linux versions I know of).

on 3), I would propose to add the x-bit(s) here because for a directory the x-bit makes searching the directory possible. Without the x-bit working with the directory will be difficult. When you allow everybodey to read and write in that directory you should also allow them to search.
You understand also that when you mount it at e.g. /mnt/exchange, you will then have /mnt/exchange/exchange?

on 4), yes, that is the direct consquence of a group number on the filesystem, being given to another group, or not even existing on the system. Better also leave it 0.

On FAT32. Like all non Unix file systems there is to be faked a lot of things. And that maens also that some properties that are normaly stored for Unix/Linux files are lost. So while USB sticks with MS fses have there value for exchanging with MS systems, better avoid them for Linux to Linux exchanges

So:
3’. Change the permissions (with chmod) for that directory “exchange” to 777 (=rwx rwx rwx)?

su
cd /media/disk-40/
mkdir exchange
chmod 777 exchange (=chmod a+rx exchange)

? (Can I stay logged in GNOME as normal user and use only the gnome terminal?)

I thought more of something like labeling the partition “eternal-ext3” and hoping Suse will mount the partition after that under /media/eternal-ext3 and I will find the directory under /media/eternal-ext3/exchange. But maybe it will be more like /dev/disk/by-label/eternal-ext3/exchange (SDB:Basics of partitions, filesystems, mount points - openSUSE #From_static_to_dynamic)? That would be a bit long way…

Greetings
pistazienfresser

On changing the permissions you are correct.

Also you can execute the mkdir and chmod from any terminal emulator, even in Gnome ;), but you have to be root, thus do

su -

in the terminal.

You have some misunderstanding in the lower part of your post.

There is a saying “everything in Unix is a file”. That means that devices are seen from this side of the Kernel as files. They are called device special files (or device files for short) and they come in two tastes: character and block. The first for devices which handle character by character (like asyncronous terminals) and the other ones for devices that handle data by blocks (like disks). You find them normaly inside the* /dev *directory… Example:

brw-rw---- 1 root disk 259, 524288 apr 22 11:31 /dev/sda1

This is a block device special file (see the b at the beginning). You also see the access bits and this shows one of the advantages of the file metaphore for a device: access to the device is controled in the same way as for every file. Same goes for owner and group. Then it starts to become a bit different. There are two numbers. These are called the major and minor number. The major number is to the number the Kernel attached internaly to the driver used by the device. Thus when the Kernel is asked for an I/O to the device it knows which driver to use. The minor number is just a bunch of bits where the device driver knows what these bits are for. Often at least part of those bits tell which device of the many that are handled by the same driver on this system it is. In this case the 259 driver can see if this is about sda1 or sda2.

When mounting we need the device special file to tell which hardware (disk partition) is used and we need the mount point to tell where we want the direrctory tree on this device to be added to our one and only system directory tree that starts at /.

Thus you never will find your data at* /dev/disk/by-label/eternal-ext3/exchange*, but at* /mount/point/exchange*.

Thus when you (and now there will be a lot of when …, all of them are more or less defaults, but no ‘must be so’) have the file system labeled eternal-ext3 and then connect it on the flight and there is somebody loged in using Gnome or KDE (working together with HAL/DeviceKit-disk) it will be mounted at /media/eternal-ext3.

And everything you have during an earlier mount created there (including exchange) will then be there under /media/eternal-ext3.

I am afraid my remark made you hesitate a bit. What I meant to show was that you can make a directory exchange at the root of that partition, but that it IS NOT the root of that partition. You can create exchange and music and movies, etc. all at the lowest level end thus there will be* /media/eternal-ext3/music*, /media/eternal-ext3/movies, /media/eternal-ext3/exchange, etc.

I think you are doing this allright, Just try it and you will most probably be satiefied.

Thanks for your explanation, hcvv. If I have understood:
there is a path to get excess to a partition (e. g.: /media/disk-100) and file that tells the operating system what to do with a (mounted) partition (e. g.: a file under /dev/disk/ or under /dev/disk/by-label/ ). They are not the same and not under the same path.

External drives may be:
a) (hot) plugged in during using GNOME or KDE
b) already been connected during the start of the computer or linux
c) plugged in by me during me being root with init 1

m) plugged out during using GNOME or KDE after unmounting them
n) …

x) plugged in an other computer with an Linux system

I want to have excess to that partition (mostly) under one path (I don’t like /media/disk-1 to /media/disk-50 or /media/eternal-ext3 to*/media/eternal-ext3_____*).

What do I have to do?
Is there a How-To for external drives and their partitions?

Greeting
pistazienfresser

P.S.: If I plug out the external drive after unmout it:
it is still connected to the USB to power so it makes: “lllllliiiuupppp” Can there be damage from that or are modern drives parked savely by their kinetic energy?

Yes. You can access the partition by reading/writing the device special file, but you are then bypassing the structure of the file system. E.g. doing a cp some-file /dev/sdb1 will destroy the files system on* /dev/sdb1* because it will write the blocks directly from the beginning of the partition and that is th place where the file system has its administration. This is one of the ways where being root and doing stupid things can be a disaster. And doing a write to /dev/sdb will even destroy the partition table because that is at the beginning of the disk.

I do not know why you mention init 1. There are two things that are separate:
. (dis)connecting. For some sort of hardware (e.g. SATA) this must be done when power is switched off. Other types of connection (USB) can be done with a running system.
. (un)mounting. Of course disks must be connected before the partitions can be mounted and the partitions must be unmounted before you disconnect. Specialy the last can go wrong with hasty people.

(Un)mounting is done of course by asking the kernel to do so. This is done using the (u)mount statements. At boot mount -a is run (by root from the startup scripts) and thus everything in /etc/fstab is mounted. During the lifetime of the system (irrespective in what runlevel) root can (u)mount and you can do that as every statement that needs root is done. As you have read allready in the link I provided earlier, udev makes the device special files (either at boot or later on connection). HAL/DeviceKit then tries to gather information on what to do and then (eventualy) does the mount (it runs under root!). But you can do such (u)mounts by CLI as root as well. There is no magic, just (u)mount statements.

See the link I provided. When you want a ‘consistent’ mount, label the file system (using e2label). HAL/DeviceKit will then mount on /media/your-label. The only thing is then that you label them different ;). When there is no label* /media/disk* will be used, but when allready in use /media/disk-1 ,etc. will be used. When you are allready at* disk-50* there is something wrong. Did you remove without umounting first?
When you do have that high disk-… numbers with far less partitions mounted you can remedy by:

  1. umount and remove all devices mounted in /media;
  2. remove everything in /media, including* .hal-mtab* and .hal-mtab-lock. These two files will be created agan when needed by HAL.

I do not know the hardware you have there. But I would use a Power Off button when there is one. Else I would suppose it is by design that removing the cable is the normal way to switch it off. I would then wait until I am satisfied that it stopt rotating (it may be that you even hear the barke, I do not know) beforetaking it n my hands/dropping it off the table. An I would off course read the manual that came with the device.