Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

copyright© Binayak Prasad Gupta.

copyright© Binayak Prasad Gupta.


Advanced Package Management

● Command one- “apt-get”

● Description: The apt-get command line tool is used to manage packages.

● Syntax: apt-get [options]

● Example 1: Update the packages list.

● Command: “apt-get update”


Output:

● Example 2: Upgrade all the packages.

● Command: “apt-get upgrade”

● Example 3: Install a package.

● Syntax: “apt-get install <package name>”

● Command: “apt-get install python3”


Output:

copyright© Binayak Prasad Gupta.


● Example 4: Remove a package.

● Syntax: “apt-get remove <package name>”

● Command: “apt-get remove python3”


Output:

● Example 5: Check for broken dependencies.

● Command: “apt-get check”


Output:

● Example 6: Download a package but do not install.

● Syntax: “apt-get -d install <package name>”

● Command: “apt-get -d install netcat”


Output:

copyright© Binayak Prasad Gupta.


● Example 7: Install a package by fixing broken dependencies if any.

● Syntax: “apt-get -f install <package name>”

● Command: “apt-get -f install netcat”


Output:

● Example 8: Install a package by assuming “yes” for all prompts.

● Syntax: “apt-get -y install <package name>”

● Command: “apt-get -y install netcat”


Output:

● Example 9: Install a package from unauthenticated repository.

● Syntax: “apt-get --allow-unauthenticated install <package name>”

copyright© Binayak Prasad Gupta.


● Command: “apt-get --allow-unauthenticated install python3”
Output:

● Command two: “apt-key”

● Description: The apt-key command line tool is used to manage APT keys.

● Syntax: “apt-key [options]”

● Example 1: Add gpg key to apt keyring.

● Command: “wget -qO - https://deb.opera.com/archive.key | sudo apt-key add –“


Output:

● Example 2: List all the APT keys.

● Command: “apt-key list”


Output:

● Example 3:

● Delete an APT key using the key id.

● Syntax: “apt-key del <key id>”

copyright© Binayak Prasad Gupta.


● Command: “apt-key del 8AE2 2BA9”
Output:

Demo – Create A User and Give Root Privileges:

● Problem Statement:

● Create a new user on Kali Linux and give the user root privileges.

● Solution

● Step 1: Create a new User

● Syntax: “sudo adduser <username>”

● Command: “sudo adduser new_user “

● Output:

● Step 2: Edit the /etc/passwd file change the UID and GID of the user to 0.

● Open the file using command: “nano /etc/passwd”

● Then the file will open as shown in the screenshot.

copyright© Binayak Prasad Gupta.


● Edit the text “new_user:x:1001:1001:,,,:/home/new_user:/bin/bash” to
“new_user:x:0:0:,,,:/home/new_user:/bin/bash” as shown in the screenshot.

● Now press “CTRL+S”to save and “CTRL+X” to exit the file.

● Now use command: “su - new_user” to login

copyright© Binayak Prasad Gupta.


copyright© Binayak Prasad Gupta.

You might also like