LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 11-28-2007, 12:20 PM   #1
jpostma
Member
 
Registered: Jun 2003
Location: Alphen ad Rijn -- The Netherlands
Distribution: Fedora Core 2 - Slackware 12
Posts: 119

Rep: Reputation: 15
How to save a file?


I want to change the contents of a config file with a text editor. When I want to save the file I am getting an error that I do not have permissions.

The only way I'm thinking of is with 'sudo vi <filename>' but I prefer to edit a file with a text editor.

Johannes
 
Old 11-28-2007, 12:25 PM   #2
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
vi is a text editor

You should be able to launch your favourite text editor in much the same way as you launch vi:
Code:
sudo <your_text_editor> <file_name>
So with kedit, that might be:
Code:
sudo kedit <file_name>
 
Old 11-28-2007, 12:27 PM   #3
jpostma
Member
 
Registered: Jun 2003
Location: Alphen ad Rijn -- The Netherlands
Distribution: Fedora Core 2 - Slackware 12
Posts: 119

Original Poster
Rep: Reputation: 15
This is not very user friendly. I want to select a file with Nautilus and click on the right mouse and open the file with a text editor.
 
Old 11-28-2007, 12:38 PM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
In that case, I don't know. Sorry

I'm sure it's possible though. Have a look through your KDE/gnome menu and see if you can launch nautilus as a superuser.
 
Old 11-28-2007, 12:58 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
I think he means he wants to use a GUI text editor as root. But, root doesn't normally have GUI ability in the users environment.

Here's how to let root have GUI:

From the command line, as user:
xhost + localhost

Then su to root, and start the app from the command line:
kedit

When kedit opens, from the kedit menu, File - Open
and find the file to open.

Last edited by bigrigdriver; 11-28-2007 at 01:02 PM.
 
Old 11-29-2007, 03:12 AM   #6
jpostma
Member
 
Registered: Jun 2003
Location: Alphen ad Rijn -- The Netherlands
Distribution: Fedora Core 2 - Slackware 12
Posts: 119

Original Poster
Rep: Reputation: 15
Thank you for the information. I have created a new menu item with the command 'gksudo nautilus'. Nautilus will now be opened with the root user.
 
Old 11-29-2007, 03:19 AM   #7
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Originally Posted by bigrigdriver
From the command line, as user:
xhost + localhost
If I'm not totally mistaken, that's something you really should _not_ do, ever (for security reasons).

gksudo is the graphical sudo app, and the way to go when needing superuser rights without accessing commandline - so adding a new Nautilus entry is the right thing to do. The other way is, like mentioned,
 
  


Reply



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
How can read from file.txt C++ where can save this file(file.txt) to start reading sam_22 Programming 1 01-11-2007 05:11 PM
Not able to save file shadow11 Linux - Newbie 4 10-21-2004 08:15 PM
where should I save this file??? bruno buys Linux - Software 2 08-17-2004 06:54 PM
Mozilla 1.7 - No File Save / File Open dialogs on Slackware 10.0 jayseye Slackware 8 08-10-2004 05:52 AM
how to save a file? Longinus Programming 5 03-10-2004 10:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 10:52 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration