You are not logged in.

#1 2020-01-15 21:11:24

light9876
Member
Registered: 2020-01-05
Posts: 142

[SOLVED] Permission denied error on ext4 mounted drive

I have been trying to solve this issue for a week now, I tried the following in different combinations but I still can't figure out what I'm doing wrong.

Here is what I'm doing:

1. I install arch with 3 partitions:

/dev/sdb1 # efi partition
/dev/sdb2 # ext4 partition for /
/dev/sdb3 # ext4 for /home
mkfs.fat /dev/sdb1
mkfs.ext4 /dev/sdb2
mkfs.ext4 /dev/sdb3

I don't touch the /etc/fstab file while installing arch.

2. I finish installation, and I login. Then I do:

mount /dev/sdb3 /mnt/home
sudo chmod 777 /mnt/home

3. I move all files in /home into /mnt/home

4. I edit my /etc/fstab, which becomes:

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=29adab35-2422-4140-9521-131907710e66 / ext4 rw,relatime 0 1

# /dev/sda1
UUID=8BC4-144A /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2

# /dev/sda3
UUID=e7fd1368-fcbb-43d5-9a1f-93e249c3b8e7 /home ext4 users,defaults,noatime 1 2

5. Then I restart my computer.

6. Now the drive gets mounted correctly, but I can't write any files inside my ~ directory.

What am I doing wrong please?

Last edited by light9876 (2020-01-16 07:17:42)

Offline

#2 2020-01-15 21:25:16

light9876
Member
Registered: 2020-01-05
Posts: 142

Re: [SOLVED] Permission denied error on ext4 mounted drive

lsblk

[me@me ~]$ lsblk --output NAME,FSTYPE,LABEL,SIZE,UUID,TYPE,FSAVAIL,FSUSE%,MOUNTPOINT
NAME   FSTYPE LABEL   SIZE UUID                                 TYPE FSAVAIL FSUSE% MOUNTPOINT
sda                 931.5G                                      disk                
├─sda1 vfat           1.4G 8BC4-144A                            part    1.4G     0% /boot/efi
├─sda2 ext4          95.4G 29adab35-2422-4140-9521-131907710e66 part   84.8G     4% /
└─sda3 ext4         834.7G e7fd1368-fcbb-43d5-9a1f-93e249c3b8e7 part  778.8G     0% /home

Offline

#3 2020-01-15 21:46:08

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: [SOLVED] Permission denied error on ext4 mounted drive

You didn't execute the command correctly.

And here is why you shouldn't
https://serverfault.com/questions/36467 … estructive

What, exactly, are to trying to achieve?

Offline

#4 2020-01-15 21:47:00

loqs
Member
Registered: 2014-03-06
Posts: 19,090

Re: [SOLVED] Permission denied error on ext4 mounted drive

Why did you not mount /home during installation?  Why the 777 chmod?
What is the output of the following executed as the none root user?

mount
stat ~
id

Offline

#5 2020-01-16 01:33:40

light9876
Member
Registered: 2020-01-05
Posts: 142

Re: [SOLVED] Permission denied error on ext4 mounted drive

Well, if I do not do chmod, then I won't have any permissions. So I did it in order to be able to make the directory writable. Otherwise I have no permissions and I can't do anything in it.

But permissions are lost once I make a restart. I understand that I shouldn't use 777, but I was only trying to find a solution..

mount

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8126952k,nr_inodes=2031738,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda2 on / type ext4 (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
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=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13391)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda3 on /home type ext4 (rw,nosuid,nodev,noexec,noatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1626868k,mode=700,uid=1000,gid=985)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=985)

stat ~

  File: /home/elias
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d	Inode: 26738689    Links: 14
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-15 18:29:32.875111949 +0000
Modify: 2020-01-15 20:46:16.898291180 +0000
Change: 2020-01-15 20:46:16.898291180 +0000
 Birth: 2020-01-15 18:29:32.875111949 +0000

id

uid=1000(elias) gid=985(users) groups=985(users),98(power),986(video),991(lp),995(audio),998(wheel),999(adm)

Last edited by light9876 (2020-01-16 01:34:25)

Offline

#6 2020-01-16 01:44:57

loqs
Member
Registered: 2014-03-06
Posts: 19,090

Re: [SOLVED] Permission denied error on ext4 mounted drive

Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

User elias:users can not create files in a directory owned by root:root with permissions 755.
Instead of changing permissions to 777 you could instead change ownership to elias:users and leave permissions as they were.
In general all files in a users home directory should be owned by that user.
Edit:
I would then change permission of the users home directory to 700.

Last edited by loqs (2020-01-16 01:49:27)

Offline

#7 2020-01-16 07:17:21

light9876
Member
Registered: 2020-01-05
Posts: 142

Re: [SOLVED] Permission denied error on ext4 mounted drive

Thank you so much!

sudo chown -R elias:users /home

The above command solves everything!

Offline

Board footer

Powered by FluxBB