You are not logged in.

#1 2004-04-01 23:41:04

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

OOPS!! Reset Home Directory permissions

I accidently reset my home permissions.  Now, I can't get into my home directory except as root.  What command can I do to make every file in my home to be read/write accesable ONLY to punkrockguy and root?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#2 2004-04-02 00:14:20

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

This is kinda important!  I need to work on this machine!  Thanks in advance!


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#3 2004-04-02 00:18:39

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: OOPS!! Reset Home Directory permissions

Set ownership to you, this command is recursive for all files in the directory too:

chown -R <i>{username}</i>:users /home/<i>{username}</i>

Set the directory to be at least accessible by the owner:

chmod o+rx /home/<i>{username}</i>

See the man pages for more details about the commands.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#4 2004-04-02 00:25:00

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

I executed the command, and I'm still getting permission denied...


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#5 2004-04-02 00:29:33

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

My username is punkrockguy318 by the way


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#6 2004-04-02 00:33:48

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: OOPS!! Reset Home Directory permissions

Yeah well, you need to replace the "username" with whatever your username is... I've edited it to reflect this a bit.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#7 2004-04-02 00:36:52

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

Okay, yeah that's what I did.  No cigar, It says Permission denied!


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#8 2004-04-02 00:38:47

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: OOPS!! Reset Home Directory permissions

Hmm, maybe the fact that I messed up the second command is causing troubles, seems weird though...

chmod u+rx /home/<i>{username}</i>

That's u (user) instead of o (others).


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#9 2004-04-02 00:45:54

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

Hmm.. It seems like I need execute permissions to access directories...  I can get everything to work my

chmod -R u+rwx /home/punkrockguy318

But I don't want everything executable!  How can I make everything except directories notexecutable?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#10 2004-04-02 00:54:55

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: OOPS!! Reset Home Directory permissions

Hmm, I had hoped the chmod didn't need to be applied recursive. You can try to use the 'find' command to make all files non-executable. From your home directory, run something like:

find -type f -exec chmod a-x "{}" ";"

See the find manpage for more details.

Of course you'll need to add the executable flag the files files you DO want to be executable, like the ones in your ~/bin and stuff called 'configure' and such.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#11 2004-04-02 01:07:04

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

Hmm... It says missing arguement to exec... I haven't used find before... I'm looking at the manpage, and I don't see anything wrong with the command.  What could it be?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#12 2004-04-02 01:13:59

normnmiles
Member
From: /US/IL
Registered: 2004-03-20
Posts: 64

Re: OOPS!! Reset Home Directory permissions

You can also try

find ~/ -type f |xargs chmod 0644

Offline

#13 2004-04-02 01:23:38

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: OOPS!! Reset Home Directory permissions

Hmm, I tried the find command like that and it seemed to be working just fine. xargs should do the job too though.

The missing argument to -exec could be because the ; is not properly recognized, the man page mentions quoting or escaping, and you should also not forget the spaces and such. It's tricky to get it right.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#14 2004-04-02 02:01:25

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: OOPS!! Reset Home Directory permissions

find -type f -exec chmod a-x "{}" ;


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#15 2004-04-02 02:05:35

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 706
Website

Re: OOPS!! Reset Home Directory permissions

Sweet, got it working!  Thanks a lot guys!  So I guess it's true you need the X permission to open directories?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#16 2004-04-02 02:23:04

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: OOPS!! Reset Home Directory permissions

That's certainly the case. The read permission is just to be able to see the listing of the files inside the directory I think.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

Board footer

Powered by FluxBB