Help about permissions

Hello,
I have purchased a new external hard disk and formatted it as 1 GB go to EXT4 and another 1 GB go to NTFS. I have problems with copying or even accessing to the EXT4 drive. I created a folder with sudo and I ran rsync to synchronise to the external HDD. If worked fine, but I cannot see the contents in normal form, I tried going to the super-user and I could see by ls command.

What is the correct permission code for my case? Thank you.

Almost all information is missing here.

Which version of openSUSE? Do you use a desktop (not realy needed here), when yes, which one.
Where did you mount it?
What do you mean which “I cannot see the contents in normal form”. What is normal for you may be abnormal for others.
You tried ls (what is very normal to me btw), and you say everything is there. Then what is the problem? And when you think there is a permission problem there, why do you not show the output of that *ls -l *command to us? We are not clairvoyant.

My guess is that the output of the following commands may help us to help you:

fdisk -l
mount
df
cat /etc/fstab
ls -l <the-mount-point>

where the last statement has to be filled in of course.

And please post those computeoutputs complete with prompt, command and output between CODE tags: http://forums.opensuse.org/english/information-new-users/advanced-how-faq-read-only/451526-posting-code-tags-guide.html

Thank you for your reply. You are right to expect the needed information which I somehow forgot.
I am using OpenSUSE 12.1.
I am using the KDE environment.
I plugged the external HDD in and the system said that it is sdb1.
I could not see the contents when I double-clicked almost every folder. The system said something like I didn’t have the permission. I saw that the owner is root.
I will show the output of ls -l command in my next message; I did not want to skip giving an answer.
I am a slow learner, so forgive me for my previous post.
Thank you for your reply and I really appreciate it. I will return with more details as soon as possible.
BA

On 2012-06-29 15:36, bakkurt wrote:

> The system said something like I didn’t have the permission. I saw that
> the owner is root.

Which is surely correct and your problem. Change the ownership and
permissions of the parent directory and all subfolders and files. Or change
the group owner and permissions, and add your user to that group.

You need to learn how Linux permissions work. Any unix/linux book will do.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Because your first post here contained almost nothing, I started to let you provide information. What I told you I was missing is ny no way all. E.g, you say " formatted it as 1 GB go to EXT4 and another 1 GB go to NTFS", but you do not tell you how you did. Did you use YaST > System > Partitioning? Something else?

The fact that you now say “I plugged the external HDD in and the system said that it is sdb1.” lets me guess that you do not use it as a permanent attached disk, but as a come and go one. Those are normaly mounted by the desktop somewhere in /mnt. Except when you have an entry iin /etc/fsttab. In short, there are a lot of possibilities and when you do not explain all you did we do simply not know. Also when it is only sdb1 it reports, what about the two partitions you say you created?

And I did not only ask for the output of an* ls -l *command, but of four other commands also.

Hello,
My external hard disk can be accessed from /media/BarbarosAkkurt and this is the ext4-formatted one having 1 TB capacity. ls -l command gives the following:

barbaros@linux-ii16:/media/BarbarosAkkurt/BarbarosAkkurtOfisYedek> ls -l
total 72
-rw-------  1 barbaros users 53776 Jun 29 13:48 bookmarks.html
drwxr-xr-x  4 barbaros root   4096 Jun 29 11:23 Desktop
drwx--x--x 57 barbaros root   4096 Jun 29 13:52 Documents
drwxr-xr-x 18 barbaros root   4096 Jun 29 11:25 Downloads
drwxr-xr-x  5 barbaros root   4096 Jun 29 11:28 Mail

fdisk -l command was not successful and gave an error message:

barbaros@linux-ii16:/media/BarbarosAkkurt/BarbarosAkkurtOfisYedek/Documents> fdisk -l
bash: fdisk: command not found

mount command had the following response:

barbaros@linux-ii16:/media/BarbarosAkkurt/BarbarosAkkurtOfisYedek/Documents> mount
devtmpfs on /dev type devtmpfs (rw,relatime,size=1331356k,nr_inodes=332839,mode=755)
tmpfs on /dev/shm type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
/dev/sda5 on / type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
tmpfs on /var/run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,relatime)
tmpfs on /var/lock type tmpfs (rw,nosuid,nodev,relatime,mode=755)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
/dev/sda6 on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/sdb1 on /media/BarbarosAkkurt type ext4 (rw,nosuid,nodev,relatime,user_xattr,acl,barrier=1,data=ordered,uhelper=udisks)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfs-fuse-daemon on /home/barbaros/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)

the command df had the following output:

barbaros@linux-ii16:/media/BarbarosAkkurt/BarbarosAkkurtOfisYedek/Documents> df
Filesystem      1K-blocks     Used Available Use% Mounted on
rootfs           20641404  5138528  14454352  27% /
devtmpfs          1331356        8   1331348   1% /dev
tmpfs             1339156     1656   1337500   1% /dev/shm
tmpfs             1339156      668   1338488   1% /run
/dev/sda5        20641404  5138528  14454352  27% /
tmpfs             1339156        0   1339156   0% /sys/fs/cgroup
tmpfs             1339156      668   1338488   1% /var/run
tmpfs             1339156      668   1338488   1% /var/lock
tmpfs             1339156        0   1339156   0% /media
/dev/sda6        31054836  6043468  23970204  21% /home
/dev/sdb1      1007930660 13843196 942887516   2% /media/BarbarosAkkurt

see the following output for cat /etc/fstab:

barbaros@linux-ii16:/media/BarbarosAkkurt/BarbarosAkkurtOfisYedek/Documents> cat /etc/fstab
/dev/disk/by-id/ata-WDC_WD3200BEVT-60A23T0_WD-WXC1A61N7022-part2 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-WDC_WD3200BEVT-60A23T0_WD-WXC1A61N7022-part5 /                    ext4       acl,user_xattr        1 1
/dev/disk/by-id/ata-WDC_WD3200BEVT-60A23T0_WD-WXC1A61N7022-part6 /home                ext4       acl,user_xattr        1 2
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

ls -l had the following output:

barbaros@linux-ii16:/media/BarbarosAkkurt/BarbarosAkkurtOfisYedek/Documents> ls -l /media/BarbarosAkkurt/
total 24
drwxr-xr-x 2 barbaros users  4096 Jun 29 13:49 BarbarosAkkurtEvYedek
drwx--x--x 6 barbaros root   4096 Jun 29 13:48 BarbarosAkkurtOfisYedek
drwx------ 2 barbaros root  16384 Jun 29 09:36 lost+found

I am starting to understand that the ownership of root will cause me trouble and I have no knowledge to change it.

Some more answers:
I used gparted to partition and format the 2TB external hard disk into 2 1TB disks, one of which was formatted with ext4 and the other with ntfs.
When I plugged in the external HDD via USB, there are two devices: NTFS_diskim as the NTFS_formatted one and BarbarosAkkurt as the ext4-formatted one. The following is the ls -l command executed at /media:

barbaros@linux-ii16:~> ls -l /media
total 4
drwx--x--x 5 barbaros root 4096 Jun 29 13:49 BarbarosAkkurt

I saw from the graphical interface that the other ntfs-formatted disk was not mounted, so it was not visible here.When I mounted it by clicking a button (no command given), the following output was produced:

barbaros@linux-ii16:~> ls -l /media
total 8
drwx--x--x 5 barbaros root  4096 Jun 29 13:49 BarbarosAkkurt
drwx------ 1 barbaros users 4096 Jun 29 13:34 NTFS_diskim

So I am speculating about the root ownership of my ext4-formatted disk. If I can find a command which will change the ownership to users, my problem will be gone. Is it true?

Are there any other info you require? If so, please let me know and I can supply the information.
Thank you
BA

You should have done the* fdisk -l *as *root, *but I think we can do without it.

I do not know how you wrote the data on that file system. You said you used *rsync. *It looks as if it is a copy of the home directory of user *barbaros, *but the group-id is wrong for a lot of files there. It should be users, like the one for bookmarks.html

Now the question is how this happened. Is this allready wrong in the original. Can you please show

ls -l ~barbaros

to compare?

And I would never let an ext4 partition mount by the automatic mechanism used by the desktop. This is designed for the usage of NTFS file systems and the like that often reside on USB sticks, camera’s, etc.

I would allways create an entry in* /etc/fstab* and create a mountpoint for it in a logical place (thus outside* /media)*. That would also see that the correct ownership, etc. was as I would like to have it.

Thank you
I have tried to do some more attempts before I gave the ls -l -barbaros command, and the output is like below:

barbaros@linux-ii16:~> ls -l -barbaros
total 420
  4 -rw-r--r--  1 barbaros    282 Jun 15 17:47 .y2usersettings
 56 -rw-r--r--  1 barbaros  54989 Jun 15 17:52 .y2log
156 -rw-------  1 barbaros 154902 Jun 29 21:48 .xsession-errors
  4 -rwxr-xr-x  1 barbaros   1455 Jun 12 11:45 .xinitrc.template
  4 -rw-r--r--  1 barbaros   1940 Jun 12 11:45 .xim.template
  4 -rw-------  1 barbaros    121 Jun 29 19:49 .Xauthority
  4 drwxr-xr-x  4 barbaros   4096 Jun 23 18:48 .wine
  4 -rw-r--r--  1 barbaros   1002 Jun 12 11:45 .vimrc
  4 drwxr-xr-x  2 barbaros   4096 Jun 25 20:55 Videos
  4 drwx------  4 barbaros   4096 Jun 15 13:24 .thunderbird
  4 drwx------  3 barbaros   4096 Jun 13 20:11 .thumbnails
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:51 Templates
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:51 .skel
  4 -rw-------  1 barbaros   3945 Jun 26 21:50 .recently-used
  4 -rw-------  1 barbaros    531 Jun 23 18:24 .pyhistory
  4 -rw-------  1 barbaros    256 Jun 12 11:52 .pulse-cookie
  4 drwx------  2 barbaros   4096 Jun 12 11:52 .pulse
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:45 public_html
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:51 Public
  4 -rw-r--r--  1 barbaros   1028 Jun 12 11:45 .profile
  4 drwxr-xr-x  2 barbaros   4096 Jun 15 19:24 Pictures
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:51 Music
  4 drwxr-xr-x  2 barbaros   4096 Jun 23 22:43 .mplayer
  4 drwx------  4 barbaros   4096 Jun 13 20:41 .mozilla
  4 drwx------  3 barbaros   4096 Jun 15 19:22 .macromedia
  4 drwx------  3 barbaros   4096 Jun 12 11:52 .local
  4 drwxr-xr-x  3 barbaros   4096 Jun 13 20:37 .libreoffice
  4 drwx------  6 barbaros   4096 Jun 13 20:33 .kde4
  4 -rw-r--r--  1 barbaros    861 Jun 12 11:45 .inputrc
  0 dr-x------  2 barbaros      0 Jun 29 19:50 .gvfs
  4 -rw-r--r--  1 barbaros    328 Jun 12 11:51 .gtkrc-2.0-kde4
  4 drwxr-xr-x  2 barbaros   4096 Jun 24 15:54 .gstreamer-0.10
  4 drwx------  2 barbaros   4096 Jun 12 11:52 .gnome2
  4 drwxr-xr-x 22 barbaros   4096 Jun 29 19:51 .gimp-2.6
  4 drwx------  3 barbaros   4096 Jun 29 19:51 .gconf
  4 -rw-r--r--  1 barbaros    508 Jun 13 20:18 .fonts.conf
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:51 .fonts
  4 drwxr-xr-x  2 barbaros   4096 Jun 29 19:50 .fontconfig
  4 -rw-------  1 barbaros     16 Jun 12 11:52 .esd_auth
  4 -rw-r--r--  1 barbaros   1637 Jun 12 11:45 .emacs
  4 drwxr-xr-x  2 barbaros   4096 Jun 25 20:39 dwhelper
  4 drwxr-xr-x  2 barbaros   4096 Jun 28 21:27 Downloads
  4 drwxr-xr-x  4 barbaros   4096 Jun 28 21:14 Documents
  4 -rw-------  1 barbaros     26 Jun 12 11:51 .dmrc
  4 drwxr-xr-x  2 barbaros   4096 Jun 23 12:42 Desktop
  4 drwx------  3 barbaros   4096 Jun 12 11:51 .dbus
  4 drwx------  9 barbaros   4096 Jun 17 16:57 .config
  4 drwx------  3 barbaros   4096 Jun 29 19:50 .cache
  4 drwxr-xr-x  2 barbaros   4096 Jun 12 11:45 bin
  4 -rw-r--r--  1 barbaros   1177 Jun 12 11:45 .bashrc
  8 -rw-------  1 barbaros   5293 Jun 29 21:18 .bash_history
  4 drwx------  3 barbaros   4096 Jun 15 19:22 .adobe
  4 drwxr-xr-x  4 root       4096 Jun 12 11:45 ..
  4 drwxr-xr-x 35 barbaros   4096 Jun 29 21:17 .

What I did was basicly trying to change the permissions of a folder from the properties (right mouse menu) menu. Then I executed this command for all the folders:

chown -R barbaros:users DirectoryName

On 2012-06-29 18:46, bakkurt wrote:

> So I am speculating about the root ownership of my ext4-formatted disk.
> If I can find a command which will change the ownership to users, my
> problem will be gone. Is it true?

Yes, that is correct.

Ok…

The typical and recommended solution is to create a directory in that disk
(as root) and chown it to your user. Then your user can write whatever he
wants in there, but not outside.

It is also possible to chown “/media/BarbarosAkkurt” to your user. This I’m
told that works in 12.1 (new feature), but maybe not because the directory
will disappear when you umount the disk, and the empty mount point will
disappear on reboot because /media is a ramdisk. And should not work on
another computer, so don’t rely on it.

However.

If you do an rsync as root, as backup, the permissions should be the same
as in the original files, so they are correct and you should not change them.

I will not explain how permissions work in Linux because it is longish and
there are better explanations than mine all over internet :slight_smile:

But I do not have a link handy, sorry.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

How difficult it it to copy/paste the command I gave you into a terminal window?
When I ask for

ls -l ~barbaros

why do you do then

ls -l -barbaros

Do not use the the GUI when we are talking because it is almost impossible for you to report exactly what you did and thus we can not know what you did.