Fedora Core 4: Editing system files as user
How can I edit system files while still logged in as user? I hate having to stop all my IM conversations, lose my place in editing program options, browser windows, etc. when I need to edit fstab or create a new system folder or something. Are there any programs that give temporary root permissions? The su command only works for the command line, and if I try to edit a system file from there, permission is denied. Any ideas?
|
This is one you could have found if you looked.
There are two ways to run commands as root from a user session. A). While logged in as root, add the user to the group sudo. When you want to run a command with root privileges: sudo command otherwise su rootpassword gives you a root shell. If you try to launch a gui based program, and it can't get the display: open a user terminal xhost<space>+ then go back to the root shell and type the program name again. |
You may also access a full screen terminals by pressing Ctrl-Alt-F(1-6). There you can login as root (or any other user) and jump back to the GUI at any time by pressing Ctrl-Alt-F7.
|
Quote:
|
Re: Fedora Core 4: Editing system files as user
Quote:
Like you could do after the su thing : 1) vi /etc/fstab --to edit the fstab file. 2) mkdir /complete path to/foldername --to create a folder. If you are typing su in a terminal to gain root permissions and then assuming that all the user processes gain root privileges then you are wrong. Only that root shell and any other processes started from that shell will have root privileges. I mean if you open up a shell and type su there, it doesn't mean that all the existing browsers that are already open will gain root privileges NO You can always launch a gui program from the root shell and that program will have root privileges. If the program cannot get the display read AwesomeMachine's post. I think you might be looking for something simpler. Which desktop are you using? If you are using KDE you could go to K menu---->System------->More Programs-------->File Manager Super User Mode or K menu---->System------->More Programs-------->Terminal Program Super User Mode It will prompt you for a root password and then give you a File Manager / Terminal Program with root privileges. Lastly, I must say that I have replied, judging on what I thought the question being asked was. If I provided some irrelevant information my apologies. Hope this helps ! |
Okay, I just logged in as root (owner) and set the user to be the owner of Filesystem, and then I logged out. It froze under the shell when I logged out, so I had to do a hard reboot. When I rebooted, it gave me the typical "was not cleanly unmounted" check, then rebooted. After I rebooted, it loads everything, but then fails loading HAL daemon and hangs up. I tried using the restore disk, that didn't work. Am I now going to have to reformat/reinstall?
|
Unless you really know what you're doing, changing permissions on system and device files is a really bad idea, as you've discovered. If you can get back to single user mode you should just reset the permissions as they are.
And you can use kdesu to become root in the GUI environment. But you really ought to get comfortable doing stuff from the command line. |
I can't even get into GNOME. Could I get a live distro and reset it from there?
|
Perhaps, but booting into signle user mode (no GUI and minimal system services) is probably easier. If you're using GRUB to boot, hit e at the boot screen to edit the kernel command line, append the word "single" (no quotes) and then boot it. Hopefully you'll be able to get into a shell and fix it.
If you changed the permissions of a device file (in the /dev directory) and you're using udev, booting off of a LiveCD wouldn't help since none of the /dev files will be created (the point of udev is to create them dynamically). You'd need to edit the udev config files in /etc/udev. If you changed permissions of something other than a /dev file, than the LiveCD method should work (just mount your system's partition and change the file back). It would help greatly if you would say what distro you're running and which file(s) you changed and how. |
good lord, i dont understand why you cant just su to root priveledges. that should work fine, i have been doing it for years. changing the entire filesystems permissions is very dangerous, and will cause programs and daemons to not load. i can be on an im and open a terminal and su and edit my fstab, hell, i can download a new kernel, unpackage it, compile it, and install it, without missing much of a beat on my im, or webpage, or whatever, the song keeps playing. this is unix... that is the way it is.. i would say that you could jsut log in as root, but you seem alittel dangerous still... so.... that is the best advice.
|
Yes i admit to being intimidated by vim, a little (I don't have the memory for all those commands) So I open a terminal and go
su (root password here when it asks you) gedit /path/to/file & An easy way to "type" the path to the filename is to drag the icon of the file into the shell window (works for folders too) Alan |
I used to find vi really intimidating as well, so I used PICO and Emacs. I use VIM now, but I only know the basic commands and thats enough for me.
|
Bram Moolenaar's guide to effective text editing
though more geared towards programming, adequate number of tips are there for simple editing also |
Use
su - instead of just su. This will take you into the root login shell. |
just a note on the terminal.
i was instant messanging a guy i know who teaches linux and has used it for a few years, i dunno if you automatically assumed this or not, but he said that you must type a '-' after the su. so #su - something to do with the dash gave you more or full root power and su just let you see or something. i'm a newbie, just giving something i'd heard from a (i think) reliable source. |
All times are GMT -5. The time now is 07:25 PM. |