LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-26-2020, 04:41 AM   #31
Roken
Member
 
Registered: Oct 2011
Location: Warrington, UK
Distribution: Arch local, Debian on VPS, several RPIs.
Posts: 288
Blog Entries: 1

Rep: Reputation: 53

Quote:
Originally Posted by hazel View Post
Usermod doesn't directly put you into the sudoers file. What happens in Debian distros is that a sudo group is predefined in sudoers with fill sudo rights, and you can use usermod to become a member of that group.

However, you need to understand that your group membership at any moment is the group membership you had when you logged in. It doesn't get automatically updated when you use usermod to add yourself to groups. So you need either to log out and log in again or to use su (your_name)- at a terminal to make the change effective. The minus sign in the command ensures that the new shell you create is a login shell.

Surely
Code:
visudo
as root is the correct way to add a user to sudoers.
 
2 members found this post helpful.
Old 05-26-2020, 04:58 AM   #32
shruggy
Member
 
Registered: Mar 2020
Posts: 948

Rep: Reputation: Disabled
Quote:
Originally Posted by Trent29 View Post
Why didn't Debian follow my usermod command to add user as a sudoer?
Code:
user@debian:/$ su
...
root@debian:/# usermod -a -G sudo user
bash: usermod: command not found
Because /usr/sbin is not in PATH for regular users. You should either
  1. specify the full path to usermod as in /usr/sbin/usermod or
  2. as hazel mentioned above, use su - to load root user environment.

Last edited by shruggy; 05-26-2020 at 01:32 PM.
 
Old 05-26-2020, 01:11 PM   #33
Trent29
Member
 
Registered: Dec 2018
Posts: 33

Original Poster
Rep: Reputation: Disabled
OK, so su - will change to a root environment within the CLI Terminal only, right? And then I would have to edit the sources.list file using perfect Linux commands, which obviously is a stretch for me right now. The Desktop window for /var/lib/apt/ will still only have regular user permissions, right?

Is there any way I can just log in to Debian as root nstead of regular user when I power up the computer? Though some day, I'd like to be able to edit the sources.list file using CLI Terminal, at this point, I'd just like to be able to open the damned folder anyway anyhow.

What do I have to do to be able to just click on the sources.list folder with a mouse cursor and have it open so that I can edit it?
 
1 members found this post helpful.
Old 05-26-2020, 01:30 PM   #34
shruggy
Member
 
Registered: Mar 2020
Posts: 948

Rep: Reputation: Disabled
To edit sources.list from the root terminal, you don't need to navigate to its folder. Just
Code:
apt edit-sources
To invoke a GUI application (e.g. GNOME editor) from regular user terminal and gain root rights (similar to sudo):
Code:
pkexec gedit

Last edited by shruggy; 05-26-2020 at 01:36 PM.
 
1 members found this post helpful.
Old 05-26-2020, 02:15 PM   #35
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware, OpenBSD
Posts: 4,348
Blog Entries: 11

Rep: Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460Reputation: 2460
Quote:
Originally Posted by Trent29 View Post
Is there any way I can just log in to Debian as root nstead of regular user when I power up the computer? Though some day, I'd like to be able to edit the sources.list file using CLI Terminal, at this point, I'd just like to be able to open the damned folder anyway anyhow.
You can't do that in the GUI because it's been set up not to accept root logins. That is simply too dangerous. You could end up surfing the web and downloading dangerous stuff simply because you had forgotten that you were root.

You can log in as root at a text console (get one by pressing ctrl+alt+F2). It's not recommended though, especially for a newbie. Again, it's dangerous. This is called the principle of "least privilege". For your own safety you work always at the lowest privilege level possible. If you need to do something that only root can do, you become root for the duration by using su or sudo and revert to being yourself as soon as you can. It is good practice for you to get used to working like that.

Last edited by hazel; 05-26-2020 at 02:17 PM.
 
1 members found this post helpful.
Old 05-26-2020, 03:58 PM   #36
quickbreakfast
Member
 
Registered: Oct 2015
Posts: 121

Rep: Reputation: Disabled
Quote:
Originally Posted by Trent29 View Post
Though some day, I'd like to be able to edit the sources.list file using CLI Terminal, at this point, I'd just like to be able to open the damned folder anyway anyhow.
Well this might help
https://wiki.debian.org/SourcesList

Part way down the page it says "using a text editor."

What follows that heading is what some posters have been trying to get you to do.

The page does not suggest what file editor to use. I suggest using nano. (which prefixes the file if you want to edit a file.)

If you follow the Debian Wiki page it tells you to do so as root.

Quote:
What do I have to do to be able to just click on the sources.list folder with a mouse cursor and have it open so that I can edit it?
That's also in the link above.
 
1 members found this post helpful.
Old 05-27-2020, 04:33 PM   #37
Trent29
Member
 
Registered: Dec 2018
Posts: 33

Original Poster
Rep: Reputation: Disabled
Talking

Hey! I was able to successfully run apt-get update and to be certain I also successfully ran apt-get install vlc. Thank you so much to everyone here who perservered with me - it is very, very much appreciated!

Before I mark this as solved, I have a couple follow up questions:

Why didn't the pkexec gedit command work as either user or root?

Could you guys take a look at my sources.list file below and tell me if those repository urls are "good enough" or should I try to add more?

Code:
user@debian:/etc/apt$ pkexec gedit
Unable to init server: Could not connect: Connection refused

(gedit:2762): Gtk-WARNING **: 12:14:59.240: cannot open display: 
user@debian:/etc/apt$ apt edit-sources
E: Could not open lock file /etc/apt/sources.list - open (13: Permission denied)
user@debian:/etc/apt$ su
Password: 
root@debian:/etc/apt# apt edit-sources

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.tiny

Choose 1-2 [1]: 1
Your '/etc/apt/sources.list' file changed, please run 'apt-get update'.
root@debian:/etc/apt# 
  


GNU nano 3.2                 /etc/apt/sources.list                    

# 

# deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 DVD Binary-1 20200509-10:26]/ buster contrib main

deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 DVD Binary-1 20200509-10:26]/ buster contrib main

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main contrib
deb-src http://security.debian.org/debian-security buster/updates main contrib

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib
deb-src http://deb.debian.org/debian/ buster-updates main contrib

I just inserted a # and a space in front of the 2nd

Code:
deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 DVD Binary-1 20200509-10:26]/ buster contrib main
to make it look like the first.

Code:
# deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 DVD Binary-1 20200509-10:26]/ buster contrib main

# deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 DVD Binary-1 20200509-10:26]/ buster contrib main
Wonder why Debian would put that same line in twice, but only uncommented it once? To haze newbies like me??
 
1 members found this post helpful.
Old 05-27-2020, 05:29 PM   #38
quickbreakfast
Member
 
Registered: Oct 2015
Posts: 121

Rep: Reputation: Disabled
Quote:
Originally Posted by Trent29 View Post
Could you guys take a look at my sources.list file below and tell me if those repository urls are "good enough" or should I try to add more?
As far as I am concerned, if it works, I won't try and fix it.

However if you want the quickest mirror, have a gander round the Debian wiki. Somewhere it is bound to have a page telling you how to find your quickest mirror, and how to connect to it.

Bear in mind connecting to several mirrors might break your system.

Code:
Choose 1-2 [1]: 1
Your '/etc/apt/sources.list' file changed, please run 'apt-get update'.
root@debian:/etc/apt#
The above code is asking you to update your system. I hope you did that before installing anything.

If you didn't not, please do so now.

Keeping you system up to date, say weekly, reduces the chance of it being hacked.

Last edited by quickbreakfast; 05-27-2020 at 05:30 PM.
 
1 members found this post helpful.
Old 05-27-2020, 07:37 PM   #39
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,960

Rep: Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130
Might need to start using apt instead of apt-get.

https://itsfoss.com/apt-vs-apt-get-difference/

Last edited by jefro; 05-27-2020 at 07:42 PM.
 
1 members found this post helpful.
Old 05-28-2020, 12:04 PM   #40
Trent29
Member
 
Registered: Dec 2018
Posts: 33

Original Poster
Rep: Reputation: Disabled
Anyone care to comment on why the pkexec gedit command didn't work as either user or root? shruggy?

It seemed to accept my password after I gave the command, but I got this error message:

Code:
user@debian:/etc/apt$ pkexec gedit
Unable to init server: Could not connect: Connection refused

(gedit:2762): Gtk-WARNING **: 12:14:59.240: cannot open display:
 
Old 05-28-2020, 12:20 PM   #41
shruggy
Member
 
Registered: Mar 2020
Posts: 948

Rep: Reputation: Disabled
Is it GNOME? Try running it not from a terminal but from Alt+F2 window.
 
Old 05-28-2020, 03:06 PM   #42
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,960

Rep: Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130
Policy kit ... ????

http://www.webupd8.org/2015/03/how-t...s-as-root.html
https://unix.stackexchange.com/quest...y-using-pkexec
https://manpages.ubuntu.com/manpages.../pkexec.1.html
 
1 members found this post helpful.
Old 05-28-2020, 03:33 PM   #43
shruggy
Member
 
Registered: Mar 2020
Posts: 948

Rep: Reputation: Disabled
Ah, thanks jefro. So the easiest option would be
Code:
apt install nautilus-admin
 
Old 05-28-2020, 07:39 PM   #44
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,960

Rep: Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130
Hahaha. I got lost on easy a few pages back.

I'd have thought some way to access root to use vi or vim a long time ago.
 
Old 05-29-2020, 12:42 PM   #45
Trent29
Member
 
Registered: Dec 2018
Posts: 33

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thanks very much for the links and command. I will certainly try that.

Just so you guys know, whenever I hit Alt-F2 or Ctrl-Alt-F2 while using Debian, all that happens is that my sound volume is turned down to zero. Is this really supposed to open a text console? My computer starts up with Gnome but I also installed KDE, though I haven't tried KDE yet.
 
  


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
[SOLVED] sudo apt update and sudo apt-get update giving error cryptonic472 Linux - Software 7 08-24-2019 08:16 AM
Howabout apt-get update ; apt-get upgrade -f -y --force-yes in the crontab every week frenchn00b Debian 1 04-05-2008 07:47 AM
Apt-get update and apt-get upgrade rapattack Debian 32 01-28-2008 09:04 AM
apt-get install not working / apt-get update is ok remy215 Debian 2 10-01-2005 07:02 PM
Does 'apt-get update' update the database used by 'apt-cache'? davidas Debian 5 04-20-2004 01:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:20 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration