I'm running Ubuntu 16.04.4 LTS and facing a problem. All of a sudden I'm unable to edit files that I could before, I cannot run programs due to permission errors.
I'm always logged in as a user ejaz
belonging to primary group ejaz
and secondary groups root
adm
cdrom
sudo
dip
www-data
plugdev
lpadmin
sambashare
kismet
wireshark
docker
. I have several websites in sub-directories of /var/www/html/
(not in ~/public_html
because it is a dev machine with no security/sharing considerations). Taking a website, /var/www/html/test
, for example; it belongs to user:group www-data:www-data
. Me, logged in as ejaz
, am getting permission errors while editing files in test
directory. I seem to have correct group permissions to edit this directory.
Output of groups
command
~ » groups ejaz
ejaz : ejaz root adm cdrom sudo dip www-data plugdev lpadmin sambashare kismet wireshark docker
Permissons for test
site
/var/www/html » l | grep test
drwxrwxr-x 2 www-data www-data 4.0K Apr 9 2017 test
But any editing results in permission errors
/var/www/html » cd test
/var/www/html/test » l
total 16K
drwxrwxr-x 2 www-data www-data 4.0K Apr 9 2017 .
drwxrwxr-x 87 www-data www-data 4.0K Jul 10 06:50 ..
-rw-rw-r-- 1 www-data www-data 0 Apr 9 2017 blah.html
-rw-rw-r-- 1 www-data www-data 16 Apr 9 2017 .htaccess
-rw-rw-r-- 1 www-data www-data 73 Apr 9 2017 index1.html
/var/www/html/test » touch blah.html
touch: cannot touch 'blah.html': Permission denied
Output of id
command
/var/www/html/test » id -Gn
ejaz
which is understandable since ejaz
is the primary group.
But If I su
as ejaz
, I'm able to edit the file in terminal and in any program that is launched from that particular terminal instance
Question
Why am I not able to edit the files all of a sudden and how was I able to edit those files before? All I did since yesterday was to run Ubuntu's apt upgrade.
Any help will be greatly appreciated.
Thanks for reading.
Update # 1
Output of sudo mount
command
~ » sudo mount
[sudo] password for ejaz:
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=4021496k,nr_inodes=1005374,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=808412k,mode=755)
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
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/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
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/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=27,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/var/lib/snapd/snaps/core_4917.snap on /snap/core/4917 type squashfs (ro,nodev,relatime)
/var/lib/snapd/snaps/core_4650.snap on /snap/core/4650 type squashfs (ro,nodev,relatime)
/var/lib/snapd/snaps/core_4830.snap on /snap/core/4830 type squashfs (ro,nodev,relatime)
/var/lib/snapd/snaps/pycharm-community_62.snap on /snap/pycharm-community/62 type squashfs (ro,nodev,relatime)
/var/lib/snapd/snaps/pycharm-community_60.snap on /snap/pycharm-community/60 type squashfs (ro,nodev,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
/var/lib/snapd/snaps/pycharm-community_64.snap on /snap/pycharm-community/64 type squashfs (ro,nodev,relatime)
/dev/sda4 on /mnt/SSD2 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=808412k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
Output of sudo df -h
command
~ » sudo df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 790M 9.3M 781M 2% /run
/dev/sda1 82G 75G 2.3G 98% /
tmpfs 3.9G 165M 3.7G 5% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop0 87M 87M 0 100% /snap/core/4917
/dev/loop1 87M 87M 0 100% /snap/core/4650
/dev/loop2 87M 87M 0 100% /snap/core/4830
/dev/loop4 233M 233M 0 100% /snap/pycharm-community/62
/dev/loop3 240M 240M 0 100% /snap/pycharm-community/60
/dev/loop5 237M 237M 0 100% /snap/pycharm-community/64
/dev/sda4 136G 125G 11G 92% /mnt/SSD2
tmpfs 790M 28K 790M 1% /run/user/1000
Update # 2
Update # 3
reducing reserved blocks to 0 didn't help
Update # 4
I forgot to mention it earlier but I think it is worth mentioning that I often run Windows 7 on this PC using VirtualBox. Windows has access to /var/www/html/
and /mnt/SSD2/
via VirtualBox sharing. I have been running Windows for ~ a year but could that have caused the permissions mess?
Regarding the extent of what Windows does to the shared directories, I exclusively use Widows to run Adobe Photoshop, so Windows essentially reads some images from /mnt/SSD2
or /var/www/html/html
and stores images in /mnt/SSD2/*
. No huge file manipulation is done in Windows on shared directories, e.g., compressing directories, extracting compressed files, moving directories around, setting permissions etc.
Update # 5
The blurred out text is of following pattern..
/var/www/html/magento_site_1
/var/www/html/magento_site_1/var/session/sess_xxxxxxxxxxxxxxxxxxxxxxxxxx
/var/www/html/magento_site_1
/var/www/html/magento_site_1/var/session/sess_xxxxxxxxxxxxxxxxxxxxxxxxxx
/var/www/html/magento_site_1
/var/www/html/magento_site_1/var/session/sess_xxxxxxxxxxxxxxxxxxxxxxxxxx
/var/www/html/magento_site_1
/var/www/html/magento_site_1/var/session/sess_xxxxxxxxxxxxxxxxxxxxxxxxxx
....
with xxxxxxxxxxxxxxxxxxxxxxxxxx
being a random string. The screenshot is complete output.
Update #6
Output of
cd /var/www/html/test
sudo trace-cmd record -o /tmp/trace.dat -e all touch blah.html
cd /tmp
run trace-cmd report
Update 7
I left my computer turned on overnight to download some files in /mnt/SSD2
on the single SSD my computer has, and came back to this in the morning
Upon rebooting I got a busybox
initramfs
command prompt where running fsck /dev/sda1/
allowed me to use my PC again, but is this connected to permissions issues I'm having? Is my SSD dying? Is it the newly installed kernel which was installed using sudo apt upgrade
shortly before the permissions issue started occurring?
test
directory/
has ~8GB of free space. About file system being writable, how do I check that? I am able to edit files in the terminal instance if I runsu ejaz
command it in.sudo df -h
andsudo mount
to the post, so we can see what's what?