====== [hemmerling] Debian Linux 2/4 ======
Related page:
*[[debian.html|Debian Linux 1/4]].
*[[debian03.html|Debian Linux 3/4]].
*[[debian04.html|Debian Linux 4/4]].
*[[unix.html|Unix 1/12]].
*[[unix02.html|Unix 2/12 - Linux & BSD Distributions]].
*[[linuxskills.html|Linux Skills & Skill Certification]].
===== General Linux / Unix Commands =====
==== chmod ====
=== Command Examples ===
=== Resources ===
*[[http://www.computerhope.com/unix/uchmod.htm|Computer Hope. Free computer help since 1998 "Linux chmod command"]].
*[[http://www.ionos.com/digitalguide/server/know-how/allocating-directory-rights-with-chmod/|IONOS "What is chmod?"]] - "chmod help & examples".
*[[http://unix.stackexchange.com/questions/639438/whats-the-difference-between-chmod-ax-and-chmod-x|StackExchange "What's the difference between `chmod a+x` and `chmod +x`? [duplicate]"]].
*a+x will set all the x bits of the file.
*+x will set all the x bits of the file that are not present in the umask.
*[[http://unix.stackexchange.com/questions/429421/why-does-chmod-w-not-give-write-permission-to-othero|StackExchange "Why does chmod +w not give write permission to other(o)"]].
*[[http://wiki.ubuntuusers.de/chmod/|ubuntuusers - Fragen ist menschlich!]].
*[[http://www.warp.dev/terminus/chmod-x|Warp "Chmod +X"]] - "Understanding Chmod +X - Making Files Executable".
*To make a script executable by every user on the system:
$ chmod +x script.sh
==== su, "su -" and sudo ====
=== PATH on Debian Linux ===
*Default user:
$printenv
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
*su ( root ):
$su
$printenv
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
*su - ( root ):
$su -
$printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
=== Add a user "USERNAME" to the "sudo" group, as first and only user ===
$su -
Password:
# $apt install sudo
$usermod -aG sudo USERNAME
$getent group sudo
=== Alternative ( unnecessary complex ? ) Instructions for Debian 10.7 ===
*Add the USERNAME ( of the user as which you are logged in ) to the group "sudoers".
-( Open a terminal ).
-su root
-( Input root password. root is already member of the group "sudoers" :-) ).
-apt-get install sudo -y
-//su -//
-adduser **username** sudo
-//logout//
-chmod 0440 /etc/sudoers
-exit
-sudo reboot
-( Input root password ).
-( reboot manually if "sudo reboot" doesn't work )
=== How to become "root" on Debian Live Installation ===
*"sudo su" & lowercase ( "-L" ) or lowercase ( "- -Login" ):
sudo su -l
sudo su --login
=== Resources ===
*With Debian Linux, the default user is not member of the group "sudoers". This is unexpected, from point of use of an Ubuntu user!!!
*If you try any administrative tasks starting with "sudo", even after giving the right password, you are rejected by
Username Is Not In The Sudoers File. This Incident Will Be Reported
*Especially, the "GDebi Package Installer" quits without error message after entering the right password :-(.
*[[http://en.wikipedia.org/wiki/Su_%28Unix%29|EN.Wikipedia "su (Unix)"]], [[http://de.wikipedia.org/wiki/Su_%28Unix%29|DE.Wikipedia "su (Unix)"]].
*[[http://en.wikipedia.org/wiki/Sudo|EN.Wikipedia "sudo"]], [[http://de.wikipedia.org/wiki/Sudo|DE.Wikipedia "sudo"]].
*[[http://wiki.debian.org/sudo/|Debian Wiki "sudo"]].
*Debian:
*[[http://www.reddit.com/r/linuxquestions/comments/pcfjo6/bash_usermod_command_not_found_in_latest_debian/|reddit "/r/linuxquestions" - "bash: usermod: command not found (in latest Debian 11 install)"]] - "You probably used **su** to become root. Try using **su -** instead".
*[[http://www.cloudpanel.io/tutorial/how-to-add-user-to-sudoers-in-debian/|CloudPanel "How to Add User to Sudoers in Debian"]].
*[[http://unix.stackexchange.com/questions/179954/username-is-not-in-the-sudoers-file-this-incident-will-be-reported|StackExchange "Username is not in the sudoers file. This incident will be reported"]].
*[[http://unix.stackexchange.com/questions/565665/bash-adduser-command-not-found-debian-buster|StackExchange "bash: adduser: command not found [Debian Buster]"]].
*[[http://www.techrepublic.com/article/how-to-install-sudo-on-a-debian-minimal-server/|TechRepublic "How to install sudo on a Debian minimal server"]].
*[[http://debianforum.de/forum/viewtopic.php?t=175456|Debian Forum "Unterschied su und su - root ?"]].
*"Es genügt su -, und durch den Bindestrich bekommst du eine login-shell, was dir die Umgebungsvariablen des Benutzers gibt, zu dem du wechselst (ohne Angabe ist das root)".
*"Der PATH, der bei su gesetzt wird, beinhaltet nicht mehr /sbin und /usr/sbin, wodurch einige Programme nicht mehr durch Kurzeingabe des Programmnamens erreichbar sind. Durch Langeingabe geht es aber weiterhin".
*[[http://www.debianforum.de/forum/viewtopic.php?t=137945|Debian Forum "Default (Root) Passwort für Debian Live Installation...?"]], 2012.
*Switch to "root":
sudo su -l
sudo su --login
*You may also set a new root password:
sudo passwd root
*Ubuntu:
*[[http://www.thegeekstuff.com/2009/09/ubuntu-tips-how-to-login-using-su-command-su-gives-authentication-failure-error-message/|The Geek Stuff "Ubuntu Tips: How To Enable Root User ( Super User ) in Ubuntu"]].
*[[http://www.tecmint.com/fix-user-is-not-in-the-sudoers-file-the-incident-will-be-reported-ubuntu/|Techmint "How to Fix 'Username is not in the sudoers file. This incident will be reported” in Ubuntu']] - This does not work for me.
==== mount & umount ====
*[[http://www.man7.org/linux/man-pages/man8/umount.8.html|man7 "umount"]].
*[[http://www.man7.org/linux/man-pages/man8/mount.8.html|man8 "umount"]].
*[[http://www.xinux.net/|Xinix Wiki]].
*[[http://www.xinux.net/index.php/Linux_mount_und_umount|Xinix Wiki "Linux mount und umount"]].
===== Untested =====
==== Forgotten root Password ====
*[[http://web.archive.org/web/*/http://www.debiantutorials.org/reset-root-password-debian-gnulinux-etch-286.html|Archive.org "Debian Tutorials 'Reset your root Password on your Debian Machine'"]] -> Modify Debian Linux boot menu by adding "init=/bin/bash" as additional boot parameter to "/vmlinuz-2.6.18-5-486".
*With my current Debian 12.0 system, the line looks like this
linux /boot/vmlinuz6.1.0-37-amd64 root:UUD=XXXXXXXXXXXXXXXXXXX ro quiet
*[[http://www.askubuntu.com/questions/91188/authentication-token-manipulation-error|Ask Ubuntu "Authentication token manipulation error"]] -> "mount -rw -o remount /".
{{tag>linux debian}}