You are not logged in.

#1 2011-07-10 19:44:03

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Accidentaly changed file/folders permissions to 777...

Hello, i screwed up my HOME files, i have movies, text files etc. I changed the file permissions to 777 cause i couldn't copy them on external drive (don't know why). How do i change to the defaults? What are the defaults? Please help!!! sad

Edit: i did from ubuntu live cd (in order to copy the files on external media).

chmod 777 *

to every directory and subdirectory (there aren't many).

Last edited by 1lj4z1 (2011-07-10 19:48:29)

Offline

#2 2011-07-10 20:10:05

lukaszan
Member
Registered: 2011-05-05
Posts: 117

Re: Accidentaly changed file/folders permissions to 777...

644 should do the trick. For binaries (if you have ~/bin folder or such) 755.

Offline

#3 2011-07-10 20:29:17

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,532
Website

Re: Accidentaly changed file/folders permissions to 777...

See the fix function in my .bashrc

https://github.com/graysky2/configs/tre … r/dotfiles


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2011-07-10 22:23:52

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

@lukaszan I did a:

chmod 644 *

and now i can't access my folders...

@graysky how do I run the script?

p.s. thanks guys.

Offline

#5 2011-07-10 22:29:28

gregor
Member
From: /planet/tmpfs
Registered: 2011-06-20
Posts: 175

Re: Accidentaly changed file/folders permissions to 777...

strange chmod 777  means access for all.....

Offline

#6 2011-07-10 22:32:07

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

gregor wrote:

strange chmod 777  means access for all.....

I know, I don't want that. I want the normal ones.

Offline

#7 2011-07-10 22:53:09

gregor
Member
From: /planet/tmpfs
Registered: 2011-06-20
Posts: 175

Re: Accidentaly changed file/folders permissions to 777...

i can give you only my /home as an example


[greglee@PSi_baLL ~]$ ls -la
total 724
drwxr-xr-x 48 greglee root    4096 Jul 10 23:44 .
drwxr-xr-x  3 root    root    4096 Feb  5 18:55 ..
drwx------  2 greglee users   4096 Feb  8 17:34 .AbiSuite
drwxr-x 5 greglee users   4096 Jul 10 23:09 abs
drwx------  3 greglee users   4096 Feb  5 19:00 .adobe
9r-x drwxr-xr-x  4 greglee users   4096 Jul 11 00:03 .aMule
-rw-------  1 greglee users      7 Jul 10 23:58 .bash_history
-rwxr-xr-x  1 greglee root      56 Jun  2 12:56 .bashrc
drwxr-xr-x  2 greglee users   4096 Jul 10 23:56 bewaren
drwxrwxrwt  4 root    root      80 Jul 10 22:46 .cache
drwx------  2 greglee users   4096 Jul  3 12:19 .cmus
drwxr-xr-x 41 greglee root    4096 Jul  3 00:03 .config
-rwxr-xr-x  1 greglee root    1111 Apr 22 21:45 .conkyrc
-rwxr-xr-x  1 greglee users   1288 Apr 22 21:45 .conkyrc1
drwx------  3 greglee users   4096 Feb  5 18:25 .dbus
-rw-------  1 greglee users    626 Jul  1 22:54 dead.letter
drwxr-xr-x  4 greglee users   4096 Mar 10 21:55 .designer
drwxr-xr-x  2 greglee users   4096 May  1 23:27 Desktop
-rw-r--r--  1 greglee users  24625 Jul 10 23:45 .dmenu_cache
drwxr-xr-x  4 greglee users   4096 Jul 10 23:07 Downloads
-rw-r--r--  1 greglee users    566 Jun 27 15:42 .dwm.log
-rw-------  1 greglee users     16 Feb 13 02:49 .esd_auth
drwxr-xr-x  2 greglee users   4096 Jul  6 20:42 exec
-rw-r--r--  1 greglee users     42 Jul  1 20:39 .fehbg
drwxr-xr-x  2 greglee users   4096 Jun  2 23:26 .fontconfig
-rw-r--r--  1 greglee users    529 Mar 10 19:59 .fonts.conf
drwxr-xr-x  2 greglee users   4096 Mar 25 17:34 .Foxit
drwxr-xr-x  6 greglee users   4096 May 17 23:03 FrostWire
drwxr-xr-x 10 greglee users   4096 Jul  6 20:39 .frostwire4.20
drwxr-xr-x  5 greglee users   4096 Jul 11 00:08 .frostwire5
drwxr-xr-x  2 greglee users   4096 Mar 13 03:08 ftp
drwx------  4 greglee users   4096 Jul 11 00:27 .gconf
drwx------  2 greglee users   4096 Jul 11 00:27 .gconfd
drwxr-xr-x 22 greglee users   4096 Jun 26 11:02 .gimp-2.6
-rw-r-----  1 greglee users      0 Jun  5 00:35 .gksu.lock
-rw-r--r--  1 greglee users     89 Apr 30 01:12 .gmrun_history
drwx------  6 greglee users   4096 May 17 17:27 .gnome2
drwx------  4 greglee users   4096 Mar 13 02:43 .gnupg
drwxr-xr-x  2 greglee users   4096 Jun 28 22:19 .gstreamer-0.10
-rw-------  1 greglee users      0 Jun  5 01:26 .gtk-bookmarks
-rw-r--r--  1 greglee users    471 Apr 12 21:14 .gtkrc-2.0
drwx------  2 greglee users   4096 Feb  5 18:27 .gvfs
drwxr--r--  2 greglee users   4096 Feb  6 21:53 .hardinfo
-rw-r--r--  1 greglee users    580 Jul  1 21:47 .htoprc
-rw-------  1 greglee users  22782 Jul  6 21:48 .ICEauthority
drwx------  2 greglee users   4096 May 18 00:17 .kde4
-rw-------  1 greglee users    345 Feb 21 20:46 .kderc
drwx------  3 greglee users   4096 Feb 22 16:57 .local
drwx------  3 greglee users   4096 Feb  5 19:00 .macromedia
drwx------  3 greglee users   4096 Jul 10 23:58 .mc
-rw-------  1 greglee users   9521 Apr 12 04:51 .mc.menu
drwxr-xr-x  4 greglee users   4096 Jun 29 21:30 moblock
lrwxrwxrwx  1 greglee users     32 May 19 18:53 moblock-start -> /home/greglee/exec/moblock-start
lrwxrwxrwx  1 greglee users     31 May 19 18:53 moblock-stop -> /home/greglee/exec/moblock-stop
drwx------  2 greglee users   4096 Jul 11 00:11 mov
drwxr-xr-x  2 greglee users   4096 Mar 25 17:23 .mplayer
drwxr-xr-x  6 greglee users   4096 Jul  4 21:39 music
drwxr-xr-x  2 greglee users   4096 Jul  6 21:17 .netsurf
-rw-r--r--  1 greglee users    339 Apr 19 21:43 onthouden
drwx------  3 greglee users   4096 Feb  5 18:31 .pki
drwx------  2 greglee users   4096 Jul  6 20:21 .pulse
-rw-------  1 greglee users    256 Feb 13 02:49 .pulse-cookie
drwx------  4 greglee users   4096 Feb 21 19:21 .speech-dispatcher
drwx------  6 greglee users   4096 Jun 27 20:05 .system
drwxr-xr-x  4 greglee users   4096 Apr 12 21:11 .themes
drwx------  4 greglee users   4096 Feb 25 20:58 .thumbnails
drwxr-xr-x  3 greglee users   4096 Jul  6 21:34 tmp
drwx------  2 greglee users   4096 Mar 19 02:28 .TrueCrypt
drwxr-xr-x  2 greglee users   4096 Jun 11 08:55 .tuxcmd
-rw-r--r--  1 greglee users 398892 May 18 00:37 Untitled.png
drwxr-xr-x  2 greglee users   4096 Feb 27 00:08 .wicd
-rw-------  1 greglee users     53 Jul 10 23:44 .Xauthority
-rwxr-xr-x  1 greglee root     798 Feb  6 00:14 .Xdefaults
-rwxr-xr-x  1 greglee root     528 Jul  6 21:45 .xinitrc
-rw-r--r--  1 greglee root     100 Feb  6 00:14 .xsession

the file permissions are in the beginning of the lines ,it seems you have quite some work to change it back......

Offline

#8 2011-07-10 22:56:02

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

@gregor i don't care about .xxxx files i care about my data only. and i don't know the defaults.

Offline

#9 2011-07-10 23:05:32

gregor
Member
From: /planet/tmpfs
Registered: 2011-06-20
Posts: 175

Re: Accidentaly changed file/folders permissions to 777...

try install tux commander  "sudo pacman -Sy tuxcmd" then you can edit the file permissions on the fly....

Last edited by gregor (2011-07-10 23:12:21)

Offline

#10 2011-07-10 23:14:35

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,276

Re: Accidentaly changed file/folders permissions to 777...

If you did this to your root directory, reinstall.

I'm confused though, you say you did this to your home folder, and that shouldn't cause any problems (aside from it being horribly insecure). If only your home folder files are affected, just run

chmod -R 750 ~

or whatever you want the permissiosn to be.

Last edited by WorMzy (2011-07-10 23:17:17)


Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Online

#11 2011-07-10 23:23:21

gregor
Member
From: /planet/tmpfs
Registered: 2011-06-20
Posts: 175

Re: Accidentaly changed file/folders permissions to 777...

WorMzy wrote:

I'm confused though, you say you did this to your home folder, and that shouldn't cause any problems

...that's what i meant

Offline

#12 2011-07-10 23:55:43

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

Okay, here's the story. My nautilus crashes so i wanted to backup my data (music, videos, documents, photos) and i went through live cd (ubuntu natty) and tried to copy my data on external storage, BUT it didn't let me cause my permissions were wrong on some files. Then i did a chmod 777 * to every folder and it changed permissions but then i got again an error message. I figured a way copying my data to the external storage through terminal with CP without the need of the live cd. Now i am concerned on what permissions the data should have, is it okay leaving it on 777? or should i change them back to the permission they had (but i don't know which permission they had).

So will this do the work?

chmod -R 750 ~

Last edited by 1lj4z1 (2011-07-11 00:03:28)

Offline

#13 2011-07-11 00:11:02

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,532
Website

Re: Accidentaly changed file/folders permissions to 777...

1lj4z1 wrote:

So will this do the work?

chmod -R 750 ~

That will make everything rwxr-x--- which is kinda odd.  Typically, users go with either 700 (private) or 755 (read) for their $HOME.  Note that a consequence of that -R is that all files and dirs under $HOME will also get that permissions.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#14 2011-07-11 00:12:48

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

Ah i am comfused, Do you know what permissions my files had by default before i changed them? So i can change them back.

edit: i'll go to sleep, i'll check replies tomorrow. thanks guys.

Last edited by 1lj4z1 (2011-07-11 00:21:04)

Offline

#15 2011-07-11 04:03:11

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Accidentaly changed file/folders permissions to 777...

graysky wrote:

Typically, users go with either 700 (private) or 755 (read) for their $HOME.

I agree with that. By default everytime I create folder/file in my $HOME, I get :

1. 700 for all folder
2. 755 for all file

Maybe you should change all inside your $HOME with 700 for folder and 755 for file first,
and then (maybe) you check again all folder/file (maybe for folder/file owner and group)


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#16 2011-07-11 04:18:15

AurosGamma
Member
From: San Cristobal,Venezuela
Registered: 2011-02-22
Posts: 132

Re: Accidentaly changed file/folders permissions to 777...

The default permissions for a Home folder (when you create a user) is 700,  the content usually is 755, probably because you copied your data from a fat32 drive, or a filesystem without permissions capabilities, so these are the default permissions in this case.

If i were you i would do the following:

$ chmod 700 ~ && cd ~ && chmod -R 755 ./*

Greetings.

Offline

#17 2011-07-11 11:09:23

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

AurosGamma wrote:

The default permissions for a Home folder (when you create a user) is 700,  the content usually is 755, probably because you copied your data from a fat32 drive, or a filesystem without permissions capabilities, so these are the default permissions in this case.

If i were you i would do the following:

$ chmod 700 ~ && cd ~ && chmod -R 755 ./*

Greetings.

This changed everything to 755, files and folders... :S Is this right? http://i.imgur.com/j5Dlx.png

My home folder is "drwx------"

Last edited by 1lj4z1 (2011-07-11 11:13:09)

Offline

#18 2011-07-11 12:34:02

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

you confused me more!!!!! which of these is right??? all i wanna do is copy my data on the external drive with the right permissions! i can't do it from live cd when they are at 755... i want to install arch from scratch and i want to backup!!!

Offline

#19 2011-07-11 12:35:02

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Accidentaly changed file/folders permissions to 777...

Mine

igndenok@merkava ~ $ ls -l ..
total 16
drwx------ 52 igndenok igndenok 12288 Jul 11 17:35 igndenok
drwx------  2 root     root      4096 Jun  8  2010 lost+found

Edit: Inside $HOME

igndenok@merkava ~ $ ls -l
total 172
-rw-r--r--  1 igndenok igndenok  1715 Dec  9  2010 allan.pl
-rw-r--r--  1 igndenok igndenok   753 Sep 12  2010 arch1
-rw-r--r--  1 igndenok igndenok  3011 Sep 12  2010 arch2
-rwx------  1 igndenok igndenok  3821 Jul  9 20:44 bj-pics.rb
drwx------  6 igndenok igndenok  4096 Jun 15 22:32 Desktop
drwx------ 10 igndenok igndenok 20480 Jul  9 20:11 Documents
drwx------ 10 igndenok igndenok 40960 Jul 11 19:56 Downloads
-rwxr-xr-x  1 igndenok igndenok   327 May 28 21:52 euclid.pl
-rw-r--r--  1 igndenok igndenok   289 Jul  4 10:14 ex-ecm.txt
-rw-r--r--  1 igndenok igndenok   747 Jul  4 21:33 gitrev.sh
-rw-r--r--  1 igndenok igndenok  2277 Jul  7 13:37 iptables.rules
-rw-r--r--  1 igndenok igndenok  2769 Jul  8 14:50 list
-rwx------  1 igndenok igndenok   281 Sep 13  2010 log-to-pkglist.awk
-rwxr-xr-x  1 igndenok igndenok  2339 Jun 18 10:36 mangascan.rb
-rw-r--r--  1 igndenok igndenok  1163 Jun  7 22:35 mbrainz.rb
-rw-r--r--  1 igndenok igndenok  2852 Jul 11 03:07 mkinitcpio-merkava.conf
drwx------  2 igndenok igndenok  4096 Dec  3  2010 Music
-rwxr-xr-x  1 igndenok igndenok  3742 Dec 22  2010 ompload.rb
drwx------  5 igndenok igndenok  4096 Jul  9 00:59 Pictures
-rwxr-xr-x  1 igndenok igndenok  1073 Sep 18  2010 pkgextract.sh
-rw-r--r--  1 igndenok igndenok   820 Jul  4 19:07 PSX-ISO
drwx------  5 igndenok igndenok  4096 Jul  2 21:28 Public
-rw-r--r--  1 igndenok igndenok  1258 Jul 11 12:18 quote.org
-rw-r--r--  1 igndenok igndenok   369 Jun 29 21:03 saz3d.txt
-rw-r--r--  1 igndenok igndenok    95 Jul  8 21:29 thousand_arms
-rw-r--r--  1 igndenok igndenok   131 Jul  9 22:18 tmp.txt
drwx------ 13 igndenok igndenok  4096 Jul  9 14:56 Videos
-rw-r--r--  1 igndenok igndenok   752 May 31 21:16 zenburn.css

Edit #2: Inside $HOME/Pictures

igndenok@merkava ~ $ ls -l Pictures
total 1160
-rw-r--r-- 1 igndenok igndenok 1070250 May 23  2009 bg.png
-rw-r--r-- 1 igndenok igndenok    5320 Oct  1  2010 c342ea31141423_flip.png
drwxr-xr-x 4 igndenok igndenok    4096 Jul  8 14:26 h-f
-rw-r--r-- 1 igndenok igndenok     295 Jul  9 00:57 igndenok.png
drwx------ 2 igndenok igndenok    4096 Feb 27  2010 Kamen Rider
-rw------- 1 igndenok igndenok    3519 Feb  5  2008 phoenix_wright.gif
-rw------- 1 igndenok igndenok    3343 Oct  3  2010 Phoenix Wright.svg
-rw------- 1 igndenok igndenok    6760 Jan  7  2010 screenshot-1.png
-rw------- 1 igndenok igndenok    6060 Jan  7  2010 screenshot-2.png
-rw------- 1 igndenok igndenok    6144 Jan  7  2010 screenshot-3.png
-rw------- 1 igndenok igndenok    5515 Jan  7  2010 screenshot-4.png
-rw------- 1 igndenok igndenok    6343 Jan  7  2010 screenshot-5.png
-rw------- 1 igndenok igndenok    5985 Jan  7  2010 screenshot-6.png
drwx------ 2 igndenok igndenok    4096 Oct  8  2010 TuX

Edit #3: Now that AurosGamma mentioned it, I do have some files from my FAT32 partition with (old) permission 755.

Last edited by igndenok (2011-07-11 13:12:13)


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#20 2011-07-11 12:56:01

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

what about the folders in your home folder and the files?

Offline

#21 2011-07-11 13:10:56

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

Okay, i did this, i changed permissions of my data on the installed system to 777, copied them on external drive through ubuntu live cd (yeah it worked wink), and then i will install arch and copy them back to the computer. Let's see what happens tongue

Offline

#22 2011-07-11 14:15:31

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

One last question, when you copy files on a fat32 external hard drive permissions change? And what happens when you copy them back to a linux machine? They changed that's why i am asking cause folders changed to "drwx------" and files to "-rw-------".

edit: sorry if i frustrate you but this is a chance to learn these permissions thing (i studied it on college but we didn't discuss what happens in those cases tongue).

Last edited by 1lj4z1 (2011-07-11 14:19:38)

Offline

#23 2011-07-11 16:15:30

Awebb
Member
Registered: 2010-05-06
Posts: 4,331

Re: Accidentaly changed file/folders permissions to 777...

fat32 does not support linux file permissions. If you copy a file to a fat32 partition and back, the permissions will be screwed up.

By the way, I once had a similar problem, I solved it with find:

find ~ -type d -exec chmod 755 {} \;
find ~ -type f -exec chmod 644 {} \;

EDIT: Hehe, looks like graysky2's solution.

Last edited by Awebb (2011-07-11 16:17:45)

Offline

#24 2011-07-11 16:27:56

1lj4z1
Member
From: milky way galaxy
Registered: 2011-03-25
Posts: 63
Website

Re: Accidentaly changed file/folders permissions to 777...

Awebb, thanks, well i did copy the files from my fat32 external drive, and it changed the permissions (i think they are like they were and they work fine, since the files are just my data, no configuration files etc). So the move to fat32 and back was ok(?). Or maybe i should create a function that changed these, (although i frequently use my fat32 external drive... i like that .bashrc function.)

edit: what about these other permissions other people mentioned?

Last edited by 1lj4z1 (2011-07-11 16:29:40)

Offline

#25 2011-07-11 16:37:25

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Accidentaly changed file/folders permissions to 777...

Copying from FAT32, folder/file still preserve its permission from FAT32 in my $HOME.
But, when you copy to FAT32, folder/file doesn't preserve its permission from source partition.
I set this options in my fstab (options for FAT32 partition)

gid=users,dmask=007,fmask=117,iocharset=utf8

If I copy to FAT32, folder/file permission are set to 770/660.
Even my original folder/file permission are set to 700/644.

Last edited by igndenok (2011-07-11 16:38:04)


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

Board footer

Powered by FluxBB