LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permissions problem? - can't access file (http://www.linuxquestions.org/questions/linux-newbie-8/permissions-problem-cant-access-file-879655/)

carolus 05-09-2011 09:34 AM

Permissions problem? - can't access file
 
What is going on here? I can't access /etc/sshd_config to read or edit it, even as root. (Using debian-live 6.01)

root@debian:/etc# ls -l /etc/ssh*
total 132
-rw-r--r-- 1 root root 125749 2010-02-28 01:37 moduli
-rw-r--r-- 1 root root 1616 2010-02-28 01:37 ssh_config
-rw-r--r-- 1 root root 2453 2010-03-13 17:32 sshd_config
-rw------- 1 root root 668 2010-03-13 17:32 ssh_host_dsa_key
-rw-r--r-- 1 root root 619 2010-03-13 17:32 ssh_host_dsa_key.pub
-rw------- 1 root root 1671 2010-03-13 17:32 ssh_host_rsa_key
-rw-r--r-- 1 root root 411 2010-03-13 17:32 ssh_host_rsa_key.pub
root@debian:/etc# ls -l /etc/sshd_config
ls: cannot access /etc/sshd_config: No such file or directory
root@debian:/etc# whoami
root

I also checked the permissions for the parent file /etc, and root has rwx.

Is this something peculiar to the overlay file system used in debian-live, or just another unix gotcha?

andrewthomas 05-09-2011 10:00 AM

is the filesystem that /etc/ is on mounted read-only?

carolus 05-09-2011 11:18 AM

mount shows:
aufs on / type aufs (rw)

I think this is the relevant mount point. There are 10 other mounts, but they are all rw too. However, "touch dummy" in /etc gives "permission denied".

andrewthomas 05-09-2011 11:25 AM

This is a live-cd, no?

Unless you are running this off a USB-stick you are not going to be able to write anything.

carolus 05-09-2011 12:05 PM

With debian-live you can write to the overlay file system in memory, though to save the changes you must make a snapshot file on USB or elsewhere. Anyway, I can reproduce the problem on Ubuntu 10.10 (full installation, not the live disk) running as a virtual machine in Virtualbox.

carolus 05-09-2011 01:57 PM

After discovering that this was a more general problem, I tried googling with the specific filename and found the following:

http://www.linuxquestions.org/questi...s-root-510959/

This seems to answer the question, if only I could understand it.

MODYSAMA 05-09-2011 02:23 PM

try:
Code:

sudo su
chmod x+r /etc/sshd_config
pico /etc/sshd_config

or
Code:

chmod +x /etc/sshd_config
chmod +r /etc/sshd_config
pico /etc/sshd_config


carolus 05-09-2011 02:33 PM

After looking at man chattr, it appears that ext2 has some file permissions outside the nice clean unix tradition. For example
"A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute."
The change can apparently be made only with the ext2-specific utility "chattr".

Not as nasty as Windows ACL's, but heading in that direction.


All times are GMT -5. The time now is 08:25 PM.