2

Today I used sudo chmod +x * -R in my $HOME folder, actually I didn't want to use it in $HOME folder, it was an accident. Afterthat I tried to use sudo chmod -x * to fix it. But now, I couldn't open any file in $HOME folder with user permission. I can use root permission to open them. I used ll to check that all files are owned by the user, but why can't I open them? Please help me.

my bash history(in ~/.bash_history):

sudo chmod +x * -R
ll
chmod -x -R *
ll
sudo chmod +x * -R
ll
sudo chmod +w * -R
ll
cd ~/Desktop/
sudo cd ~/Desktop/
sudo chmod -x * 
ll
df -h
ll
cd ~/Desktop/
sudo cd ~/Desktop/
sudo cd /home/nix/Desktop/
sudo chmod -x * -R
ll
cd ~/Desktop/
su
gnome-open 1.png &
sudo gnome-open 1.png &
sudo gnome-open 1.png 
cd 
cd cd skypeFiles/
sudo cd skypeFiles/
ls -a
cd .config/
ls
cd ..
cd .local/
ls
cd share/
ls
cd applications/
ll
chmod +x *
ll
cd ..
chmod +x * -R
su
sudo chown nix:nix -R nix/
ll

At first I tried to chmod -x * to fix it, nothing works. And then I found that I can use sudo gnome-open to open files(while only gnome-open didn't work), I guessed maybe there was something worng with my .desktop files. After I entered .local/share/applications, there was only "mimeapps.list*" here, so maybe I was wrong.

nix@***:~$ ls -la
total 324
drwxr-xr-x 53 nix  nix   4096 Jan  1 14:01 .
drwxr-xr-x  3 root root  4096 Dec 29 21:40 ..
drwx------  3 nix  nix   4096 Dec 29 18:22 .adobe
drwx------  2 nix  nix   4096 Dec 31 21:40 .aptitude
-rw-------  1 nix  nix   9131 Jan  1 14:28 .bash_history
-rw-r--r--  1 nix  nix    220 Apr  9  2014 .bash_logout
-rw-r--r--  1 nix  nix   3870 Dec 29 20:51 .bashrc
-rw-r--r--  1 nix  nix   3870 Dec 29 20:51 .bashrc~

Considering for my privacy, I deleted some result of the command ls -la, for it didn't really matter in this problem.

Ryan
  • 123

2 Answers2

4

by running

sudo chmod -x * -R

you just removed execution rights to everything under your current directory, including subdirectories. This should not prevent to open files in the current directory for editing or reading, but this prevents you to open subdirectories and the files inside. You do not have to fiddle with "root" user. Just run the following :

find . -type d

and you should get an error

find: 'xxxxx': Permission denied

for all subdirectories xxxxx in your current directory which name doesn't starts with a "." (dot). To fix, run

find . -type d -exec chmod +x {} +

and your subdirectories access will be restored. You'll then have to set proper execution rights on any formerly executable file in your subdirectories tree. Only you can find which files need it.

muru
  • 197,895
  • 55
  • 485
  • 740
r.g
  • 56
-1

Open your terminal and change to root user (else sudo would do)

First take a backup of current home directory of yours.

Then paste as

sudo chown -R youusername:yourusername /home/yourusername

That will again makes you true owner of your home.

Replace yourusername with your username.

let me know if any issues.

Raja G
  • 102,391
  • 106
  • 255
  • 328