Sudo Prefix

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 ::slight_smile: ::slight_smile:

You’re right, but why the confusion?

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

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).

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 :slight_smile:

Jocklad :slight_smile:

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

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

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.

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.

That makes things a lot clearer.

Thanks Mark :slight_smile: :slight_smile: :slight_smile:

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 :slight_smile:

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.

Thanks Mark for your explanation on Sudo.

Makes much more sense to me now.

Jocklad :slight_smile: :slight_smile:

If you Do anything as Super User (root)

Its Super User Do :- sudo