Debian – -bash: sudo: command not found

aptdebiansusudo

I am trying to deploy django app.
When I print
apt-get update
I see

W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (13: Permission denied)
W: Unable to read /etc/apt/sources.list.d/ - DirectoryExists (13: Permission denied)
W: Unable to read /etc/apt/sources.list - RealFileExists (13: Permission denied)
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
E: Unable to read /var/cache/apt/ - opendir (13: Permission denied)
E: Unable to read /var/cache/apt/ - opendir (13: Permission denied)
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

When I print sudo apt-get update
I see

-bash: sudo: command not found

I tried to use su instead of sudo.
But it is strange.
For example I print su apt-get update
And nothing happens
I just see a new line,

(uiserver):u78600811:~$ su apt-get update
(uiserver):u78600811:~$

The same if I try to install some packages.
What do I do?

If it is useful info – I am using Debian

(uiserver):u87600811:~$ uname -a
Linux infong1559 3.14.0-ui16294-uiabi1-infong-amd64 #1 SMP Debian 3.14.79-2~ui80+4 (2016-10-20) x86_64 GNU/Linux

Best Answer

By default sudo is not installed on Debian, but you can install it. First enable su-mode:
su -

Install sudo by running:
apt-get install sudo -y

After that you would need to play around with users and permissions. Give sudo right to your own user.

usermod -aG sudo yourusername

Make sure your sudoers file have sudo group added. Run:
visudo to modify sudoers file and add following line into it (if it is missing):

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

You need to relogin or reboot device completely for changes to take effect.

Related Question