Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
10-01-2005, 07:24 PM
|
#1
|
Member
Registered: Aug 2005
Location: God's barf bag
Distribution: Ubuntu 7.04 (Feisty Fawn)
Posts: 86
Rep:
|
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?
|
|
|
10-01-2005, 08:14 PM
|
#2
|
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
|
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.
|
|
1 members found this post helpful.
|
10-02-2005, 01:15 AM
|
#3
|
LQ Newbie
Registered: May 2004
Posts: 4
Rep:
|
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.
|
|
|
10-02-2005, 01:34 AM
|
#4
|
Member
Registered: May 2004
Location: India
Distribution: openSUSE Tumbleweed
Posts: 94
Rep:
|
Quote:
The su command only works for the command line, and if I try to edit a system file from there, permission is denied.
|
intimidated by vim?
|
|
|
10-02-2005, 02:10 AM
|
#5
|
Member
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345
Rep:
|
Re: Fedora Core 4: Editing system files as user
Quote:
Originally posted by JRR883
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?
|
Now that's wierd ! Permission denied ? What permissions are denied. You can easily edit system files by opening a terminal, using su to gain root permissions, and then opening up the relevant file with vi.
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 !
Last edited by koodoo; 10-02-2005 at 02:37 AM.
|
|
|
10-02-2005, 12:40 PM
|
#6
|
Member
Registered: Aug 2005
Location: God's barf bag
Distribution: Ubuntu 7.04 (Feisty Fawn)
Posts: 86
Original Poster
Rep:
|
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?
|
|
|
10-02-2005, 03:09 PM
|
#7
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
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.
|
|
|
10-02-2005, 09:08 PM
|
#8
|
Member
Registered: Aug 2005
Location: God's barf bag
Distribution: Ubuntu 7.04 (Feisty Fawn)
Posts: 86
Original Poster
Rep:
|
I can't even get into GNOME. Could I get a live distro and reset it from there?
|
|
|
10-02-2005, 09:56 PM
|
#9
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
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.
|
|
|
10-02-2005, 11:12 PM
|
#10
|
Member
Registered: Apr 2005
Distribution: Slackware
Posts: 350
Rep:
|
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.
|
|
|
10-06-2005, 03:49 AM
|
#11
|
LQ Newbie
Registered: Sep 2003
Location: watford UK
Distribution: Mepis 6.0
Posts: 28
Rep:
|
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
|
|
|
10-06-2005, 10:36 AM
|
#12
|
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298
Rep:
|
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.
|
|
|
10-06-2005, 02:55 PM
|
#13
|
Member
Registered: May 2004
Location: India
Distribution: openSUSE Tumbleweed
Posts: 94
Rep:
|
Bram Moolenaar's guide to effective text editing
though more geared towards programming, adequate number of tips are there for simple editing also
|
|
|
10-10-2005, 12:14 PM
|
#14
|
LQ Newbie
Registered: Sep 2005
Location: Earth
Distribution: fedora core 4
Posts: 8
Rep:
|
Use
su -
instead of just su.
This will take you into the root login shell.
|
|
|
10-10-2005, 12:21 PM
|
#15
|
LQ Newbie
Registered: Sep 2005
Location: USA western
Distribution: fedora core 4
Posts: 10
Rep:
|
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 06:54 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|