LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 08-06-2014, 03:37 AM   #1
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Rep: Reputation: Disabled
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.
 
Old 08-06-2014, 03:43 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,249
Blog Entries: 24

Rep: Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190
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:

Quote:
sudo su -
... 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.
Old 08-06-2014, 03:44 AM   #3
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,720

Rep: Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704
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.
 
Old 08-06-2014, 03:46 AM   #4
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
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:

Code:
sudo vi /etc/hosts
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.
 
Old 08-06-2014, 10:36 AM   #5
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-06-2014, 12:33 PM   #6
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-06-2014, 03:07 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,249
Blog Entries: 24

Rep: Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190
Quote:
Originally Posted by Don Littlefield View Post
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.
Old 08-06-2014, 03:52 PM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by Don Littlefield View Post
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.
Old 08-06-2014, 06:44 PM   #9
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-06-2014, 10:20 PM   #10
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
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.
Old 08-07-2014, 12:32 PM   #11
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-07-2014, 12:35 PM   #12
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Original Poster
Rep: Reputation: Disabled
How do you insert the code box in your posts? I don't see any box or button for that.
 
Old 08-07-2014, 12:53 PM   #13
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by Don Littlefield View Post
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]


Code:
your code here
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.
Old 08-07-2014, 01:03 PM   #14
Don Littlefield
Member
 
Registered: Jul 2014
Location: Waldron Arkansas
Distribution: Debian 10 Buster
Posts: 49

Original Poster
Rep: Reputation: Disabled
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
 
Old 08-07-2014, 01:18 PM   #15
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

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


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
How to add user with root privileges and SSH access filmon Linux - Newbie 6 11-02-2010 01:35 PM
phpmyadmin root cannot change privileges blizunt7 Linux - Software 3 03-31-2008 09:03 PM
How to add user with root privileges and SSH access adamrad Linux - General 8 10-31-2006 03:53 PM
Cant access external HD as user, cant change permissions as root? Kramer Linux - Software 3 01-12-2006 03:56 PM
Can't change privileges for my second harddrive even though I am root cmlal Linux - Newbie 13 11-03-2005 05:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:56 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