LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 10-01-2005, 07:24 PM   #1
JRR883
Member
 
Registered: Aug 2005
Location: God's barf bag
Distribution: Ubuntu 7.04 (Feisty Fawn)
Posts: 86

Rep: Reputation: 15
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?
 
Old 10-01-2005, 08:14 PM   #2
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
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.
Old 10-02-2005, 01:15 AM   #3
yoshi789
LQ Newbie
 
Registered: May 2004
Posts: 4

Rep: Reputation: 0
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.
 
Old 10-02-2005, 01:34 AM   #4
pintooo15
Member
 
Registered: May 2004
Location: on the interwebz
Distribution: linux mint 13/sled 11 sp2
Posts: 72

Rep: Reputation: 21
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?
 
Old 10-02-2005, 02:10 AM   #5
koodoo
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: Reputation: 32
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.
 
Old 10-02-2005, 12:40 PM   #6
JRR883
Member
 
Registered: Aug 2005
Location: God's barf bag
Distribution: Ubuntu 7.04 (Feisty Fawn)
Posts: 86

Original Poster
Rep: Reputation: 15
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?
 
Old 10-02-2005, 03:09 PM   #7
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,118

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
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.
 
Old 10-02-2005, 09:08 PM   #8
JRR883
Member
 
Registered: Aug 2005
Location: God's barf bag
Distribution: Ubuntu 7.04 (Feisty Fawn)
Posts: 86

Original Poster
Rep: Reputation: 15
I can't even get into GNOME. Could I get a live distro and reset it from there?
 
Old 10-02-2005, 09:56 PM   #9
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,118

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
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.
 
Old 10-02-2005, 11:12 PM   #10
edong23
Member
 
Registered: Apr 2005
Distribution: Slackware
Posts: 350

Rep: Reputation: 30
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.
 
Old 10-06-2005, 03:49 AM   #11
alan_h404
LQ Newbie
 
Registered: Sep 2003
Location: watford UK
Distribution: Mepis 6.0
Posts: 28

Rep: Reputation: 15
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
 
Old 10-06-2005, 10:36 AM   #12
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
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.
 
Old 10-06-2005, 02:55 PM   #13
pintooo15
Member
 
Registered: May 2004
Location: on the interwebz
Distribution: linux mint 13/sled 11 sp2
Posts: 72

Rep: Reputation: 21
Bram Moolenaar's guide to effective text editing

though more geared towards programming, adequate number of tips are there for simple editing also
 
Old 10-10-2005, 12:14 PM   #14
rony358
LQ Newbie
 
Registered: Sep 2005
Location: Earth
Distribution: fedora core 4
Posts: 8

Rep: Reputation: 0
Use
su -
instead of just su.
This will take you into the root login shell.
 
Old 10-10-2005, 12:21 PM   #15
datatab1
LQ Newbie
 
Registered: Sep 2005
Location: USA western
Distribution: fedora core 4
Posts: 10

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Files removed from file system during Fedora Core Upgrade gryphonavocatio Linux - General 5 09-21-2005 12:27 PM
editing files as user? Groundhog1248 Linux - Newbie 2 11-25-2004 12:28 PM
editing system files paschim Linux - Newbie 2 10-12-2004 08:58 AM
Need some help editing UT 2003 user files. z-vet Linux - Games 2 10-08-2004 09:14 AM
Editing System Files wasabi Fedora 2 06-05-2004 08:28 PM


All times are GMT -5. The time now is 07:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration