Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
|
 |
|
08-06-2014, 03:37 AM
|
#1
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Rep: 
|
How to change user privileges to root access to edit and save files
I have a new install on a new system. I will be the only user so I need to be able to modify and change some of the files. I have read many times that I will need to change to root access to fix something and then change back to regular user to prevent danger of mistakes causing problems. I understand this but I can not find out how to make change to root and change back.
First need is to edit sources.list to include printer driver and updates line. I can edit but not save the changes because I am not root. This is only the first change I need to make. I have read the beginning guide to file security but I don't think it will give me the access I need or does it?
Thanks for the help.
|
|
|
08-06-2014, 03:43 AM
|
#2
|
Moderator
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,313
|
If you are using a Buntu then I think you can use sudo per-command, like this (example):
Quote:
sudo vi /path-to/sources.lst
|
To change to root user for all succeeding commands:
... after which you will be root for all purposes until you type exit.
When sudo asks for your password, it is your user password, not root password (If I recall correctly, Ubuntu does not have a root password).
|
|
1 members found this post helpful.
|
08-06-2014, 03:44 AM
|
#3
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Hi,
by default, on Ubuntu you prefix commands that should be run as root with sudo. Eg
Code:
sudo nano /etc/apt/sources.list
Evo2.
|
|
|
08-06-2014, 03:46 AM
|
#4
|
Member
Registered: Jan 2012
Location: South Africa
Posts: 509
|
Hi there,
Which Linux distribution are you running?
Are you referring to running command line or GUI tools as root?
On most distros, you can run a command line tool as root by prefixing it with "sudo", for example:
If that doesn't work, you can run "su" to switch to root temporarily & run a shell, and "exit" from there to get back to your normal user.
I hope this helps.
|
|
|
08-06-2014, 10:36 AM
|
#5
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Original Poster
Rep: 
|
My signature describes my system. 14.04LTS.
I used Gedit for the editor. Also how to display the code box.
sudo gedit /etc/apt/sources.list
I completed the edit by copy and pasting the printer line at the bottom of the code. I put in a comment
# This line is from Linux Printing Driver Epson page for getting print driver and auto updates.
When I try to save the changes its error code is "you are not root" can not save.
|
|
|
08-06-2014, 12:33 PM
|
#6
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Original Poster
Rep: 
|
I admit I really do not know how to use Vi editor. I was using Gedit but it gives error messages
indicating it is a Gnome editor. It does not save my changes either.
I did manage to change the permissions on /etc/apt/sources.list using
chmod 777 sources.list
and it worked. now ls -l reads I have permissions to make changes. Gedit would not save the changes
because it could not talk to Gnome. Is there a better editor than Vi that is not so awkward to use?
I just found Kate. I like it and it worked easy. ONWARD.
|
|
|
08-06-2014, 03:07 PM
|
#7
|
Moderator
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,313
|
Quote:
Originally Posted by Don Littlefield
I admit I really do not know how to use Vi editor. I was using Gedit but it gives error messages
indicating it is a Gnome editor. It does not save my changes either.
I did manage to change the permissions on /etc/apt/sources.list using
chmod 777 sources.list
and it worked. now ls -l reads I have permissions to make changes. Gedit would not save the changes
because it could not talk to Gnome. Is there a better editor than Vi that is not so awkward to use?
I just found Kate. I like it and it worked easy. ONWARD.
|
Hi Don!
Glad you got it working with Kate.
I would encourage you to learn a shell based editor, with Vi (Vim) being preferred mostly because it is pretty much common to all Unix/Linux platforms and you will never outgrow it!
It can be a little disorienting for the uninitiated when you open it the first time, but it really is as simple to use as any plain text editor.
I once posted a short guide to help get you past the first close encounter, find it here (you can ignore the Slackware symlink part), and also work through the tutorial that comes with vim by typing vimtutor in a shell.
There are also pico and nano (not sure if those are native to the Buntus), but I always view them as crutches so why cripple yourself - learn your way into and out of Vim and life will be good!
Good luck!
PS: I forgot to mention that you really don't want to chmod 777 anything, especially configs and system files. But my psycho... psychotic... psychic powers tell me that a small flaming mammal will tell you this in the near future! Listen to him! 
Last edited by astrogeek; 08-06-2014 at 04:11 PM.
|
|
1 members found this post helpful.
|
08-06-2014, 03:52 PM
|
#8
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
Quote:
Originally Posted by Don Littlefield
I admit I really do not know how to use Vi editor. I was using Gedit but it gives error messages
indicating it is a Gnome editor. It does not save my changes either.
I did manage to change the permissions on /etc/apt/sources.list using
chmod 777 sources.list
and it worked. now ls -l reads I have permissions to make changes. Gedit would not save the changes
because it could not talk to Gnome. Is there a better editor than Vi that is not so awkward to use?
I just found Kate. I like it and it worked easy. ONWARD.
|
never chmod a file to 777 unless you really, *really* need to and understand what you are doing
open a terminal
Code:
sudo gedit /path/to/file
vi/vim is just too useful to ignore, spend some time with vimtutor ( as already suggested )
|
|
1 members found this post helpful.
|
08-06-2014, 06:44 PM
|
#9
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Original Poster
Rep: 
|
I managed to make my changes and changed it back to 761 after I finished. Can you make Linux recheck all hardware without a reboot? In Windoz I always had to reboot when you updated anything. I downloaded the printer driver from open printer . org. and installed it but it still does not show. I did try there install procedure to add the driver to the sources.list. I was successful in editing the file to include there info. Copy and paste so no errors. When I run the update it does its job till it gets to the new line which fails because of the signature not being the same.
How to I fix that?
I tried to copy from the output form the Terminal but it would not copy here. So I will try to type it.
W: GPG error: Http://www.openprinting/org lsb3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 24CBF5474CFD1E2F
I will try to learn the Vi/Vim editor and thanks for the link. I really did hate it 15 years ago and it is not better. I do have the O'rilly vi Editor Pocket Reference book, January 1999, to use. One of the few books I kept from before.
|
|
|
08-06-2014, 10:20 PM
|
#10
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
You seldom have to reboot after software updates, and you don't need to install updates to install updates, to install the latest updates ublike windows.
I honestly don't understand why updating windows has to be such a lengthy painfull process.
even with wsusoffline it takes far too long..
Setting up a printer should be simple.
Look in settings -> printers
Add printer, chances are it will be found and automagically configured.
If not try installing "cups"
Code:
sudo apt-get install cups
I would avoid adding third party repos , you shouldn't need them as a good distro will have everything you need
edit it out for now
|
|
1 members found this post helpful.
|
08-07-2014, 12:32 PM
|
#11
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Original Poster
Rep: 
|
Installing the printer was a real pain the first time as it is not in any of the lists for auto install. I did find the printer in the open printing . org pages and got the driver there. i downloaded it and it installed itself the first time. This time it is not completing properly. When it first installs it leaves the printer driver in serial port configuration but the printer is a USB. There is very little to work with on the printer config page but after messing with it a while it updated to USB. It is not complete yet because it still did not print a test page which it will do when it completes the proper setup. All that I did with the sources.list is apparently not working because when I run update it still gets and error about the signatures. I do not understand about signatures and how to fix the problem. I just did a copy and it worked. I also tried to do another test page but no joy. I looked at all the screens and found one that querys the printer for default settings. I did that and it printed the test page when it got done. JOY JOY.
|
|
|
08-07-2014, 12:35 PM
|
#12
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Original Poster
Rep: 
|
How do you insert the code box in your posts? I don't see any box or button for that.
|
|
|
08-07-2014, 12:53 PM
|
#13
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
Quote:
Originally Posted by Don Littlefield
How do you insert the code box in your posts? I don't see any box or button for that.
|
http://www.linuxquestions.org/questi....php?do=bbcode
[code]
your code here
[/code]
for anyone interested in how I post the code tags without them making code boxes..
[noparse]
[code]
your code here
[/code]
[/noparse]
Edit:
there is a button for it in the 'advanced' editor ( the # button ), but I never use it myself
Last edited by Firerat; 08-07-2014 at 12:56 PM.
|
|
1 members found this post helpful.
|
08-07-2014, 01:03 PM
|
#14
|
Member
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49
Original Poster
Rep: 
|
I am not finding a way to print from the Terminal. Do you do something like cat the file to Pipe to print or something like that?
Last edited by Don Littlefield; 08-07-2014 at 01:51 PM.
Reason: words out of order in BBcode
|
|
|
08-07-2014, 01:18 PM
|
#15
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
must admit never tried myself ( until now )
a quick search "linux print file from terminal cups"
got me this
http://www.eecs.utk.edu/resources/it...x-command-line
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 03:21 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
|
|