Author Topic: Sudo Prefix  (Read 3150 times)

0 Members and 1 Guest are viewing this topic.

Jocklad 1

  • Guest
Sudo Prefix
« on: November 28, 2014, 08:53:40 pm »

 Just a query...

 For example: If you run apt-get update in terminal it asks if you are root.

 Which means to me it needs a Sudo prefix to carry out the command.

 Or am I missing something here...?.

Jocklad  ::) ::)

Offline galaxytdm

  • Ubuntu 11.04
  • Sr. Member
  • ****
  • Posts: 335
  • Karma: 7
  • Gender: Male
  • Something Something dark side
    • View Profile
    • Awards
Re: Sudo Prefix
« Reply #1 on: November 28, 2014, 08:56:27 pm »
You're right, but why the confusion?
If you need help ask a professional, then act upon their advice.
Anything less and you're just wasting peoples time.

Offline BkS

  • BkS Media Founder
  • Hero Member
  • *****
  • Posts: 1691
  • Karma: 49
  • Gender: Male
  • sudo service reality-check start
    • View Profile
    • BkS Media
    • Awards
Re: Sudo Prefix
« Reply #2 on: November 28, 2014, 09:00:07 pm »
From experience apt-get update has needed elevated privileges to make system changes which is why you need to call sudo or su.
If you try to look through Windows, you can see what the person is doing.
If you try to look through a Penguin, it WILL bite you.

Jocklad 1

  • Guest
Re: Sudo Prefix
« Reply #3 on: November 28, 2014, 09:07:22 pm »
From experience apt-get update has needed elevated privileges to make system changes which is why you need to call sudo or su.

 Thats the point I was trying to make.

 The apt-get update command on its own is useless.

 Jocklad

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18210
  • Karma: 476
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Sudo Prefix
« Reply #4 on: November 28, 2014, 09:14:07 pm »
Yeah, but why are you making the point?

[EDIT]

If you're referencing my earlier posting where the user is working in kali linux and I told him to run "apt-get update" .. he's already at a root prompt ("#" as oposed to "$") so already has elevated privileges and therefore doesn't require "sudo" (indeed the "sudo" command may not even be installed in kali).
« Last Edit: November 28, 2014, 09:18:25 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Jocklad 1

  • Guest
Re: Sudo Prefix
« Reply #5 on: November 28, 2014, 09:20:14 pm »
Yeah, but why are you making the point?

Trying to learn linux mark.

Rarely a day passes I dont learn something new about Linux.

Which is why I love my Linux.

But commands like this can only lead to confusion for people new to Linux.

Quote: PC Net Spec If you're referencing my earlier posting where the user is working in kali linux and I told him to run "apt-get update" .. he's already at a root prompt ("#" as oposed to "$") so already has elevated privileges and therefore doesn't require "sudo" (indeed the "sudo" command may not even be installed in kali).
« Last Edit: Today at 09:18:25 pm by Mark Greaves (PCNetSpec) »

Thanks Mark I seen your post.

But the purpose of the thread was a Discussion on the Sudo prefix.

Jocklad  :)


Jocklad  :)
« Last Edit: November 28, 2014, 09:34:40 pm by Jocklad 1 »

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18210
  • Karma: 476
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Sudo Prefix
« Reply #6 on: November 29, 2014, 12:14:42 pm »
commands like this can only lead to confusion for people new to Linux.

Commands like these lead to security .. and it's a fairly simple concept, if the command id going to modify anything outside your home folder it will need elevated privileges with sudo

so
Code: [Select]
apt-get download gedit
will work as long as the current directory is in your home folder .. as it only downloads the gedit.deb package to the current dikrectory

but
Code: [Select]
apt-get install gedit
won't, as it needs to install the package system wide .. so would place files in various locations such as /usr/bin/gedit which you  need elevated permission to write to.

Code: [Select]
apt-get update
updates the package caches system wide at /var/lib/apt/lists .. again you need elevated privileges to write there as it's not in your home folder.
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Jocklad 1

  • Guest
Re: Sudo Prefix
« Reply #7 on: November 29, 2014, 12:18:38 pm »

 That makes things a lot clearer.

 Thanks Mark  :) :) :)

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18210
  • Karma: 476
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Sudo Prefix
« Reply #8 on: November 29, 2014, 12:38:59 pm »
I forgot to add that prefixing a command with "sudo" will force it to prompt for your password and only allow you to elevate privileges if you are a member of the sudo group and you provide the correct password.

it's all about security :)

Where in Windows, you or any process can modify pretty much any important system files .. in Linux you (or a process) CANNOT without first being given permission by someone in the sudo group.

By making certain user accounts NOT part of the sudo group, the system administrator can effectively make sure those users can't make any system wide changes that could harm the OS or install anything .. they can only damage their own home folder.
« Last Edit: November 29, 2014, 12:43:13 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Jocklad 1

  • Guest
Re: Sudo Prefix
« Reply #9 on: November 29, 2014, 09:28:50 pm »

 Thanks Mark for your explanation on Sudo.

 Makes much more sense to me now.

 Jocklad  :) :)

Offline banko

  • Full Member
  • ***
  • Posts: 235
  • Karma: 1
  • I've just joined!
    • View Profile
    • Awards
Re: Sudo Prefix
« Reply #10 on: December 02, 2014, 07:20:04 am »
If you Do anything as Super User (root)

Its Super User Do :- sudo

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal