You are not logged in.

#1 2009-09-16 22:06:46

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

chmod driving me crazy [SOLVED]

I have used chmod many times before, but now that I'm running my own machine it is giving me problems.

I created a user blake.

I run:

chmod -R u+w /home/blake/*

But when I am logged in as blake !root...I still cant write files my home directory. hmm

Last edited by Blake Gideon (2009-09-17 03:42:58)

Offline

#2 2009-09-16 22:09:37

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: chmod driving me crazy [SOLVED]

Is the owning user actually "blake"?

Did you chmod /home/blake itself as well as the stuff in it?

Do "ls -ld /home/blake".

Offline

#3 2009-09-16 22:09:47

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

Can this help me determine if I am in the users group?

bash-4.0# apropos group | grep getgrouplist
getgrouplist (3)     - get list of groups to which a user belongs

I dont know how to execute getgrouplist


EDIT:

bash-4.0# ls -ld /home/blake/
drwx------ 11 blake blake 4096 2009-09-16 22:03 /home/blake/

Last edited by Blake Gideon (2009-09-16 22:11:27)

Offline

#4 2009-09-16 22:12:11

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: chmod driving me crazy [SOLVED]

Is your /home on a seperate partition? If so, do you give users write permission when you mount it?


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#5 2009-09-16 22:12:17

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: chmod driving me crazy [SOLVED]

A "dirty" fix:

Create a script:

#!/bin/bash

auser=$1

chown -R "$auser":"$auser" "$auser"
find "$auser" -type d -exec chmod 755 {} ;
find "$auser" ! -type d -exec chmod 644 {} ;

and run it (be root) as "<script> blake"

Offline

#6 2009-09-16 22:13:57

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

rson451 - Yes it is on a different partition.

I dont know where mounting is taking place. Is this something I should put in rc.conf?

flamelab, I am not gonna run a script, when I dont understand how its working.

Last edited by Blake Gideon (2009-09-16 22:16:02)

Offline

#7 2009-09-16 22:18:32

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

I cant even

chmod u+w /home

as root

Offline

#8 2009-09-16 22:22:13

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: chmod driving me crazy [SOLVED]

flamelab wrote:

A "dirty" fix:

Create a script:

#!/bin/bash

auser=$1

chown -R "$auser":"$auser" "$auser"
find "$auser" -type d -exec chmod 755 {} ;
find "$auser" ! -type d -exec chmod 644 {} ;

and run it (be root) as "<script> blake"

This does the same as:

chmod -R u=rwX,go= /home/blake/

Note the capital X. This one also doesn't remove execute from any scripts etc that need execute permissions.

Blake Gideon -> The script above is safe, it is:
1) recursively setting ownership to your user
2) finding all directories and making them rwxr-x-r-x permissions
3) finding all other files and making them rw-r--r-- permissions

Offline

#9 2009-09-16 22:30:44

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

I ran

chmod -R u=rwX /home/blake/

but still did not assign any permissions to the user:

drwx------ 11 blake blake  4096 2009-09-16 22:03 blake

EDIT:

This is quite an inconvienece for me, as I'm trying to keep the root filesystem clean. I need to be able to write files in my user ~/ asap. Any help is greatly appreciated big_smile

Last edited by Blake Gideon (2009-09-16 22:33:52)

Offline

#10 2009-09-16 22:36:42

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: chmod driving me crazy [SOLVED]

Blake Gideon wrote:

but still did not assign any permissions to the user:

drwx------ 11 blake blake  4096 2009-09-16 22:03 blake

That is rxw permissions for the user so I'm not sure what you mean...

Post the output of:

mount
ls -ln /home
ls -ln /home/blake/ | head
id blake

Offline

#11 2009-09-16 23:01:12

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

bash-4.0# mount
/dev/sda3 on / type ext3 (rw)
none on /dev type tmpfs (rw,relatime,mode=755)
none on /proc type proc (rw,relatime)
none on /sys type sysfs (rw,relatime)
none on /dev/pts type devpts (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda4 on /home type ext3 (rw)

bash-4.0# ls -ln /home
total 24
drwx------ 15 1000  100  4096 2009-09-15 20:42 bjg
drwx------ 11 1001 1001  4096 2009-09-16 22:03 blake
drwx------  2    0    0 16384 2009-09-15 00:28 lost+found

bash-4.0# ls -ln /home/blake | head
total 5844
drwxr-xr-x 2    0    0    4096 2009-09-16 20:20 Applications
drwxr-xr-x 3    0    0    4096 2009-09-16 19:44 Desktop
drwxr-xr-x 2 1001 1001    4096 2009-09-16 02:59 Downloads
drwxr-xr-x 2    0    0    4096 2009-09-16 22:02 Perl
drwxr-xr-x 2 1001 1001    4096 2009-09-16 06:31 Scripts
-rw-r--r-- 1    0    0 5949333 2009-09-16 20:54 sys

bash-4.0# id blake
uid=1001(blake) gid=1001(blake) groups=1001(blake),7(lp),10(wheel),91(video),92(audio),93(optical),95(storage),98(power),100(users)

Offline

#12 2009-09-16 23:12:07

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

I still cant get write permissions:

bash-4.0# chmod -R u=rwX blake
bash-4.0# ls -lh /home/blake
total 5.8M
drwxr-xr-x 2 root  root  4.0K 2009-09-16 20:20 Applications
drwxr-xr-x 3 root  root  4.0K 2009-09-16 19:44 Desktop
drwxr-xr-x 2 blake blake 4.0K 2009-09-16 02:59 Downloads
drwxr-xr-x 2 root  root  4.0K 2009-09-16 22:02 Perl
drwxr-xr-x 2 blake blake 4.0K 2009-09-16 06:31 Scripts
-rw-r--r-- 1 root  root  5.7M 2009-09-16 20:54 sys

Last edited by Blake Gideon (2009-09-16 23:13:16)

Offline

#13 2009-09-16 23:29:39

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: chmod driving me crazy [SOLVED]

Post the output of `cat /etc/fstab`


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#14 2009-09-16 23:31:43

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

bash-4.0# cat /etc/fstab
# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

/dev/cdrom             /media/cd   auto    ro,user,noauto,unhide   0      0
/dev/dvd               /media/dvd  auto    ro,user,noauto,unhide   0      0
#/dev/fd0               /media/fl   auto    user,noauto             0      0

#/dev/sda1               /boot       ext2    defaults                0      1
/dev/sda2               swap        swap    defaults                0      0
/dev/sda3               /           ext3    defaults                0      1
/dev/sda4               /home       ext3    defaults                0      1

Offline

#15 2009-09-17 00:31:58

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: chmod driving me crazy [SOLVED]

I guess what you need more urgently is a chown rather than a chmod... Preferrably a recursive one. Ls by default shows a bit but not everything, there's probably tons of hidden dirs in your homedir you don't see the permissions of, and to which a lot of applications will want to write.

Looks to me like you've been screwing around as root in your user's homedir wink.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#16 2009-09-17 00:39:20

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

I followed the instructions for creating a user by the book. I really dont know what is going on.

EDIT: I want to get this all set up right so I can "screw around" under a user account and not as root.

Last edited by Blake Gideon (2009-09-17 00:40:26)

Offline

#17 2009-09-17 01:57:34

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: chmod driving me crazy [SOLVED]

Blake Gideon wrote:
bash-4.0# chmod -R u=rwX blake
bash-4.0# ls -lh /home/blake
total 5.8M
drwxr-xr-x 2 root  root  4.0K 2009-09-16 20:20 Applications
drwxr-xr-x 3 root  root  4.0K 2009-09-16 19:44 Desktop
drwxr-xr-x 2 blake blake 4.0K 2009-09-16 02:59 Downloads
drwxr-xr-x 2 root  root  4.0K 2009-09-16 22:02 Perl
drwxr-xr-x 2 blake blake 4.0K 2009-09-16 06:31 Scripts
-rw-r--r-- 1 root  root  5.7M 2009-09-16 20:54 sys

A lot of those dirs, and probably files, are owned by root. This should fix it:

chown -R blake:blake /home/blake

You've been setting the permissions correctly all along, but the ownership was wrong.

Offline

#18 2009-09-17 01:59:12

toxygen
Member
Registered: 2008-08-22
Posts: 713

Re: chmod driving me crazy [SOLVED]

fukawi2 wrote:

A lot of those dirs, and probably files, are owned by root. This should fix it:

chown -R blake:blake /home/blake

You've been setting the permissions correctly all along, but the ownership was wrong.

I was gonna say, why not try chown -R... seems like the main issue


"I know what you're thinking, 'cause right now I'm thinking the same thing. Actually, I've been thinking it ever since I got here:
Why oh why didn't I take the BLUE pill?"

Offline

#19 2009-09-17 02:52:37

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

chown did not reem to do anything:

bash-4.0# chown -R blake:blake ./blake/
bash-4.0# ls -ln
total 24
drwx------ 15 1000  100  4096 2009-09-15 20:42 bjg
drwx------ 11 1001 1001  4096 2009-09-16 22:03 blake
drwx------  2    0    0 16384 2009-09-15 00:28 lost+found
bash-4.0# su blake
[blake@HP4510 home]$ ls -l
total 24
drwx------ 15 bjg   users  4096 2009-09-15 20:42 bjg
drwx------ 11 blake blake  4096 2009-09-16 22:03 blake
drwx------  2 root  root  16384 2009-09-15 00:28 lost+found

Offline

#20 2009-09-17 03:02:20

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: chmod driving me crazy [SOLVED]

You still havent told us _where_ you issue your commands from and postings further up - you change permissions in everything _inside_ /home/blake but not /home/blake itself!
As root do:
chown -R blake:blake /home/blake

You may also have to do a:
chmod a+rwx /home

Offline

#21 2009-09-17 03:32:10

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: chmod driving me crazy [SOLVED]

Blake Gideon wrote:

chown did not reem to do anything:

Post the output of this:

cd /home/blake
chown -R blake:blake .
ls -ln

Offline

#22 2009-09-17 03:42:31

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

chmod is now working on /home. I was always running commands as root. I guess I was having problems because i was trying to do recursive chmod's on directories beneath /home. Now I just have to figure out what the permissions should be.

Offline

#23 2009-09-17 07:31:48

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: chmod driving me crazy [SOLVED]

Blake Gideon wrote:

I guess I was having problems because i was trying to do recursive chmod's on directories beneath /home.

That shouldn't be a problem unless something is srsly fsck'ed up.

This is why we avoid working as root unless we *have* to wink

Offline

#24 2009-09-17 19:15:47

Blake Gideon
Member
From: Los Angeles, CA
Registered: 2009-09-14
Posts: 57

Re: chmod driving me crazy [SOLVED]

Do you suggest reinstalling? Is there something wrong with the way my partitions are set up? The wiki and beginners guide seem to be written for an older install as far as partition set up goes. Does my partitions table look normal? What is wrong with it?

bash-4.0# cat /etc/fstab
# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

/dev/cdrom             /media/cd   auto    ro,user,noauto,unhide   0      0
/dev/dvd               /media/dvd  auto    ro,user,noauto,unhide   0      0
#/dev/fd0               /media/fl   auto    user,noauto             0      0

#/dev/sda1               /boot       ext2    defaults                0      1
/dev/sda2               swap        swap    defaults                0      0
/dev/sda3               /           ext3    defaults                0      1
/dev/sda4               /home       ext3    defaults                0      1

Offline

#25 2009-09-17 22:37:11

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: chmod driving me crazy [SOLVED]

Your partitioning looks fine. I think it was just a problem with mixing working at root and working as your normal user which screwed up some of the ownerships on various files / directories.

Offline

Board footer

Powered by FluxBB