[vox-tech] baby steps

Bill Kendrick vox-tech@lists.lugod.org
Wed, 12 Feb 2003 10:02:31 -0800


On Wed, Feb 12, 2003 at 08:39:48AM -0800, Jim wrote:
> I don't have access to certain files even when trying to access these files 
> using shell konsole.  I su to root but still have the error message "bash: 
> /etc/samba/smb.conf: Permission denied".

You can end up with a "Permission denied" on a file that's perfectly
readable _if_ you're trying to execute it.

For example, say you had the file "foobar.txt".  If you did this:

  ./foobar.txt

You' d get:

  ./foobar.txt: Permission denied.


In your case, you might be typing simply:

  /etc/samba/smb.conf

at the command line.  Rather than using that file's path as an argument
to some other program (e.g., an editor like 'vi').



> The only way that I can modify these files is by logging out then logging
> back as user root.

Well, if it IS indeed a permissions problem (with regards to reading or
writing the file, and not any inadvertent attempt to execute it), then
yes, perhaps 'su'ing vs. "logging-out-and-back-in-as-root" is the issue.

One of the most useful things to include when reporting an issue like this
are the actual permissions of the file itself! :^)

Run this:

  ls -l /etc/samba/smb.conf

and then cut'n'paste it into your e-mail so we can all see. :^)

My "smb.conf" file looks like so:

  -rw-r--r--    1 root     root         4916 Nov 25 13:51 /etc/samba/smb.conf

Seems reasonable.  If I 'su' to root and then run "vi /etc/samba/smb.conf",
the file comes up just fine.



Now, thinking about it again, if there WERE a permission problem with
being able to read it, "vi" would be the one complaining, not "bash",
so I'm beginning to think it MUST be that you forgot to specify what
command you wanted to edit 'smb.conf' with. :^)


> Can't I somehow change my permission to access and /or modify these files?
> I would like to use the GUI to edit these files but I can't even do this
> if I don't have the permission to do so.

As with running "vi" on the file, using a GUI should work just fine,
too.  For example, under KDE, you could do something like:

  kate /etc/samba/smb.conf &

("kate" is the advanced text editor in KDE; the "&" tells your shell to
run the program 'in the background';  in other words, the Kate window will
appear, and Kate will load the file... in the meantime, your shell will
return to prompting you for another command.  It won't be 'stuck' there,
waiting for you to quit Kate.)

You could, of course, also just load the editor from the GUI.
(In KDE, click the "K" icon in the 'kicker' panel at the bottom.
In GNOME, click the "G"-shaped foot icon in the Gnome panel at the bottom.
Then dig around until you find an editor you'd like to use.  Load it up,
and then do your standard "File" -> "Open" routine.)


Note that if you run that command as your normal user, assuming the file
is readable by you (like my "smb.conf" is above... see the third "r" in
the permissions column at the far left of the "ls -l" output), you'll
be able to LOAD it.  Kate may even let you make changes in the copy it has
in memory.  You just won't be able to save back over the file.
(With the permissions show above, root and only root will be able to save
over that file!)


You'll want to try "su"ing to root in a shell, and THEN run "kate...".
(Now, there may end up being issues there about root not having permission
to display an X-Window program on your screen while you're logged in as
your normal user.  We'll cross that bridge when we decide to come to it,
though...)


> Could someone enlighten me?

Hopefully, I have already. ;^)


-- 
bill@newbreedsoftware.com                    Was I useful?  Rate this message!
http://newbreedsoftware.com/bill  http://svcs.affero.net/rm.php?r=billkendrick