Bash Sudo Command Not Found - Unix & Linux

Proper Steps to Install Sudo if Sudo not found in your linux
Written by Paayi Tech |14-Jan-2020 | 0 Comments | 243 Views

Bash Sudo Command Not Found - Unix & Linux 

If you have fresh machine and you try to run #sudo command and bash is showing sudo not found then you need to do these few steps in particular order to run sudo command.

 

//Run this command

root@f27eac0119a5:/# sudo

Bash: sudo:command not found

Sudo not found linux and unix

 

// then run su command then type passwd

root@f27eac0119a5:/# su

root@f27eac0119a5:/# passwd

Enter new UNIX password: *******

Retype new UNIX password: ******

Passwd: password updated successfully.

 

 

 

//then run the following command

root@f27eac0119a5:/# apt install sudo

Reading package lists... Done

Building dependency tree       

Reading state information... Done

E: Unable to locate package sudo

 

// If this error comes, it means you need to update apt. So run this command

root@f27eac0119a5:/# apt update

Sudo not found apt get update

 

Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]

Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]

Get:3 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [794 kB]

Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]

Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]       

Get:6 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]

Get:7 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [6783 B]

Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [19.2 kB]

Get:9 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [760 kB] 

Get:10 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]       

Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]

Get:12 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]

Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1321 kB]

Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [10.5 kB]

Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1056 kB]

Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [32.7 kB]

Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2496 B]

Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4244 B]

Fetched 17.4 MB in 3s (5182 kB/s)                     

Reading package lists... Done

Building dependency tree       

Reading state information... Done

2 packages can be upgraded. Run 'apt list --upgradable' to see them.

 

 

//Then run this command 

root@f27eac0119a5:/# apt install openssh-server

 

Sudo not found apt install openssh server

 

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following additional packages will be installed:

  ca-certificates dbus dmsetup file gir1.2-glib-2.0 krb5-locales libapparmor1 libargon2-0 libbsd0 libcap2 libcryptsetup12 libdbus-1-3

  libdevmapper1.02.1 libedit2 libexpat1 libgirepository-1.0-1 libglib2.0-0 libglib2.0-data libgssapi-krb5-2 libicu60 libidn11

  libip4tc0 libjson-c3 libk5crypto3 libkeyutils1 libkmod2 libkrb5-3 libkrb5support0 libmagic-mgc libmagic1 libmpdec2 libnss-systemd

  libpam-systemd libpsl5 libpython3-stdlib libpython3.6-minimal libpython3.6-stdlib libreadline7 libsqlite3-0 libssl1.0.0 libssl1.1

  libsystemd0 libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxmuu1 mime-support multiarch-support

  ncurses-term networkd-dispatcher openssh-client openssh-sftp-server openssl publicsuffix python3 python3-certifi python3-chardet

  python3-dbus python3-gi python3-idna python3-minimal python3-pkg-resources python3-requests python3-six python3-urllib3 python3.6

  python3.6-minimal readline-common shared-mime-info ssh-import-id systemd systemd-sysv ucf wget xauth xdg-user-dirs xz-utils

Suggested packages:

  default-dbus-session-bus | dbus-session-bus krb5-doc krb5-user iw | wireless-tools keychain libpam-ssh monkeysphere ssh-askpass

  molly-guard rssh ufw python3-doc python3-tk python3-venv python-dbus-doc python3-dbus-dbg python3-setuptools python3-cryptography

  python3-openssl python3-socks python3.6-venv python3.6-doc binutils binfmt-support readline-doc systemd-container policykit-1

The following NEW packages will be installed:

  ca-certificates dbus dmsetup file gir1.2-glib-2.0 krb5-locales libapparmor1 libargon2-0 libbsd0 libcap2 libcryptsetup12 libdbus-1-3

  libdevmapper1.02.1 libedit2 libexpat1 libgirepository-1.0-1 libglib2.0-0 libglib2.0-data libgssapi-krb5-2 libicu60 libidn11

  libip4tc0 libjson-c3 libk5crypto3 libkeyutils1 libkmod2 libkrb5-3 libkrb5support0 libmagic-mgc libmagic1 libmpdec2 libnss-systemd

  libpam-systemd libpsl5 libpython3-stdlib libpython3.6-minimal libpython3.6-stdlib libreadline7 libsqlite3-0 libssl1.0.0 libssl1.1

  libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxmuu1 mime-support multiarch-support ncurses-term

  networkd-dispatcher openssh-client openssh-server openssh-sftp-server openssl publicsuffix python3 python3-certifi python3-chardet

  python3-dbus python3-gi python3-idna python3-minimal python3-pkg-resources python3-requests python3-six python3-urllib3 python3.6

  python3.6-minimal readline-common shared-mime-info ssh-import-id systemd systemd-sysv ucf wget xauth xdg-user-dirs xz-utils

The following packages will be upgraded:

  libsystemd0

1 upgraded, 82 newly installed, 0 to remove and 1 not upgraded.

Need to get 27.3 MB of archives.

After this operation, 118 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.33 [205 kB]

Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.1 amd64 1.1.1-1ubuntu2.1~18.04.5 [1300 kB]

Get:80 http://archive.ubuntu.com/ubuntu bionic/main amd64 python3-six all 1.11.0-2 [11.4 kB]                                           

Get:81 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-urllib3 all 1.22-1ubuntu0.18.04.1 [86.0 kB]                  

Get:82 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-requests all 2.18.4-2ubuntu0.1 [58.3 kB]                     

Get:83 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 ssh-import-id all 5.7-0ubuntu1.1 [10.9 kB]                           

Fetched 27.3 MB in 7s (4048 kB/s)                                                                                                      

debconf: delaying package configuration, since apt-utils is not installed

(Reading database ... 4046 files and directories currently installed.)

Preparing to unpack .../libsystemd0_237-3ubuntu10.33_amd64.deb ...

Unpacking libsystemd0:amd64 (237-3ubuntu10.33) over (237-3ubuntu10.31) ...

Setting up libsystemd0:amd64 (237-3ubuntu10.33) ...

Selecting previously unselected package libssl1.1:amd64.

(Reading database ... 4046 files and directories currently installed.)

Preparing to unpack .../libssl1.1_1.1.1-1ubuntu2.1~18.04.5_amd64.deb ...

 

 

//Then run this command

root@f27eac0119a5:/# apt install sudo

sudo not found - apt install sudo

 

 

root@f27eac0119a5:/# apt install sudo

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following NEW packages will be installed:

  sudo

0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.

Need to get 428 kB of archives.

After this operation, 1765 kB of additional disk space will be used.

Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 sudo amd64 1.8.21p2-3ubuntu1.1 [428 kB]

Fetched 428 kB in 1s (499 kB/s)

debconf: delaying package configuration, since apt-utils is not installed

Selecting previously unselected package sudo.

(Reading database ... 9963 files and directories currently installed.)

Preparing to unpack .../sudo_1.8.21p2-3ubuntu1.1_amd64.deb ...

Unpacking sudo (1.8.21p2-3ubuntu1.1) ...

Setting up sudo (1.8.21p2-3ubuntu1.1) …

 

 

//Now you can run the command #sudo and if result comes then sudo is installed.

root@f27eac0119a5:/# sudo

sudo installed  you can check by running command by sudo

 

usage: sudo -h | -K | -k | -V

usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]

usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]

usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] []

usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] file ...

root@f27eac0119a5:/# 

 

Now you can see sudo Installed successfully.

 





Login/Sign Up

Comments




Related Posts



© Copyright 2020, All Rights Reserved. paayi.com

This site uses cookies. By continuing to use this site or clicking "I Agree", you agree to the use of cookies. Read our cookies policy and privacy statement for more information.