El Lunes, 14 de Diciembre de 2009, aalfred
escribió:> It is almost certainly a permission issue. Check it again.
I’ve tested and it works fine.
Only when directory was unreadable I got same result (error) as you
had.
I’ve re-checked:
In terminal shell:
alice@ibc-laptop:/$ whoami
=> alice
alice@ibc-laptop:/$ pwd
=> /
alice@ibc-laptop:/$ cd /home/ibc
alice@ibc-laptop:/home/ibc$
In irb using “su”:
root@ibc_laptop:/# whoami
=> root
root@ibc_laptop:/# su alice
alice@ibc-laptop:/$ pwd
=> /
alice@ibc-laptop:/$ irb -r “/tmp/kernel_su.rb”
irb> require “fileutils”
=> true
irb> su(“alice”, “alice”) do Dir.chdir("/home/ibc") ; end
(irb):2:in chdir': Permission denied - /home/ibc (Errno::EACCES) from (irb):2:in
block in irb_binding’
from /tmp/kernel.rb:11:in block in su' from /tmp/kernel.rb:9:in
fork’
from /tmp/kernel.rb:9:in su' from (irb):1:in
irb_binding’
irb> su(“alice”) do Dir.chdir("/home/ibc") ; end
(irb):3:in chdir': Permission denied - /home/ibc (Errno::EACCES) from (irb):3:in
block in irb_binding’
from /tmp/kernel.rb:11:in block in su' from /tmp/kernel.rb:9:in
fork’
from /tmp/kernel.rb:9:in su' from (irb):1:in
irb_binding’
irb> su(“openxdms”, “ibc_grp”) do Dir.chdir("/home/ibc") ; end
=> #<Process::Status: pid 10824 exit 0>
Just a notice: there is a slight difference in your tests:
Yes, I cannot access to /home/ibc directory doing:
su “alice”, “alice” do Dir.chdir("/home/ibc") ; end
but I can access doing:
su “alice”, “ibc_grp” do Dir.chdir("/home/ibc") ; end
Note that “alice” has “alice” has primary group but also belongs to
“ibc_grp”
group:
~# id alice
uid=1003(alice) gid=1003(alice) grupos=1003(alice),1004(ibc_priv)
~# ll -d /home/ibc
drwxr-x— 77 ibc ibc_grp 4,0K 2009-12-14 09:50 /home/ibc/