Ubuntu Info

From TheBestLinux.com
Revision as of 23:08, 29 January 2023 by Jamie (talk | contribs)
Jump to navigation Jump to search

Ubuntu Linux - One of the Most Popular Distributions of Linux!

Ubuntu Linux is a very popular distribution of Linux, especially among new users and hobbyists. It is comes in two basic editions, the desktop edition and the server version.

As the default Ubuntu download servers are usually very busy, I have found this URL to be pretty fast most of the time:

http://mirror.it.ubc.ca/ubuntu-releases/



Ubuntu is based on the Debian distribution, one of the oldest distros, originally based on BSD UNIX and it's packages are managed using the same Debian tools apt, though the other Debian package manager, dkkg, can also be used.

SSH Passwordless Login Setup - Connect to a Linux server using secure shell keys instead of using a name and password, which is MUCH more secure!

Here is an example of how to setup SSH key login from one Linux machine to another, using only Secure Shell keys instead of name and password, making a much more secure login method, beside being much faster and more efficient, not to mention allowing for much more complex scripting and other types of automation.

In this example, I will use two Linux machines, named "ns1" and "ubunsrv1". Their fully qualified domain names(FQDN) are ns1.dawgland.com and ubunsrv1.dwagland.com. Although ns1.dawgland.com is my home network domanin name server(DNS) running Rocky Linux(Based on Red Hat Enterprise Linux source code), it is irrelevant in this example, as the target machine, ubunsrv1.dawgland.com, is running the current long term stable release of Ubuntu Server.

To start with, while logged into the main server, ns1, create the user's SSH keys, if not already done. Here is an example of how to create those keys as user "david" on the ns1.dawgland.com machine. Note that I used the "G" switch to add the user "david" to the "wheel" group, the adminstrator group/sudoer group on Red Hat based systems. On Ubuntu, substitute the "sudo" group instead of the "wheel" group to be able to run commands using sudo:

[jamie@ns1.dawgland.com:~]$ sudo useradd -c "David J. Anderson" -G wheel -m -s /bin/bash david



Then, set the password for the new user "david":

[jamie@ns1.dawgland.com:~]$ sudo passwd david



Now that the new user "david" has been created, you need to become that user. Since you are already logged in as your normal user, to become the "david" user, or whatever username you are going with, type this command to become that user:

[jamie@ns1.dawgland.com:~]$ su - david
Password: 
Last login: Sun Jan 29 14:11:38 PST 2023 on pts/1
[david@ns1.dawgland.com:~]$



Next, create new SSH keys for the new "david" user, as "david". Just hit the "ENTER" key when it prompts you for file to save the keys as, as well as for password, so that you can login with ssh keys from scripts without having to enter passwords:

[david@ns1.dawgland.com:~]$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/david/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/david/.ssh/id_rsa.
Your public key has been saved in /home/david/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:c7vp3Y0qlDSHZ4WgB/Ae45qZEeXBNQ/v52tmhwjEmL0 david@ns1.dawgland.com
The key's randomart image is:
+---[RSA 4096]----+
|      .o+.=. .   |
|       +.+ =. .  |
|      . *=..o.   |
|       +o+B.+    |
|      . So.B. .  |
|       * oE. o   |
|      =  ... ... |
|          .+..=+.|
|         .+.o=+..|
+----[SHA256]-----+
[david@ns1.dawgland.com:~]$