![]() | Red Hat Certified System Administration 8 |
Chapter 05: Connecting to Red Hat Enterprise Linux 8Sommaire
Access remote systems using SSHSecure Shell (SSH)Accessing remote promptSecure Shell (SSH)Authentication Methods
Log in and switch users in multiuser targetsLogin ConfigurationsUsing /etc/motd and /etc/issueTo display messages during the login process, Bash uses the /etc/motd and the /etc/issue files. Messages in /etc/motd display after a user has successfully logged in to a shell. (Note that users in a graphical environment do not see its contents after a graphical login.) Using /etc/motd can be a convenient way for system administrators to inform users about an issue or a security policy, for example. ExampleEdit /etc/motd with "WELCOME ON RED HAT SERVER" Login with a standard account and Observe Boot, reboot, and shut down a system normallyPower Management Commands with systemctl[root@lab ~]# systemctl halt Halts the system.(Old Command halt)[root@lab ~]# systemctl poweroff Powers off the system. Old Command poweroff [root@lab ~]# systemctl reboot Restarts the system. Old Command reboot [root@lab ~]# systemctl suspend Suspends the system. Old Command pm-suspend [root@lab ~]# systemctl hibernate Hibernates the system. Old Command pm-hibernate [root@lab ~]# systemctl hybrid-sleep Hibernates and suspends the system. Old Command pm-suspend-hybrid Securely transfer files between systemsSecure Copy (SCP)Based on SSH , scp can be used to transfer files between machines over a secure, encrypted connection. In its design, it is very similar to rcp.transfer a local file to a remote system To transfer a local file to a remote system, use a command in the following form: For example, if you want to transfer taglist.vim to a remote machine named penguin.example.com, type the following at a shell prompt: ~]$ scp taglist.vim USER@penguin.example.com: .vim/plugin/taglist.vim USER@penguin.example.com's password: taglist.vim 100% 144KB 144.5KB/s 00:00transfer a remote file to the local system To transfer a remote file to the local system, use the following syntax: For instance, to download the .vimrc configuration file from the remote machine, type: ~]$ scp USER@penguin.example.com: .vimrc .vimrc USER@penguin.example.com's password: .vimrc 100% 2233 2.2KB/s 00:00 SFTP UtilityUSING THE SFTP UTILITY The sftp utility can be used to open a secure, interactive FTP session. In its design, it is similar to ftp except that it uses a secure, encrypted connection. To connect to a remote system, use a command in the following form:sftp username@hostname For example, to log in to a remote machine named penguin.example.com with john as a user name, type: ~]$ sftp john@penguin.example.com john@penguin.example.com's password: Connected to penguin.example.com. sftp> After you enter the correct password, you will be presented with a prompt. The sftp utility accepts a set of commands similar to those used by ftp . sftp Commandsls [directory] List the content of a remote directory. If none is supplied, a current working directory is used by default.cd directory Change the remote working directory to directory. mkdir directory Create a remote directory. rmdir path Remove a remote directory. put localfile [remotefile] Transfer localfile to a remote machine. get remotefile [localfile] Transfer remotefile from a remote machine. For a complete list of available commands, see the sftp(1) manual page. Configure key-based authentication for SSHConfiguring SSH Key-based AuthenticationLes utilisateurs peuvent authentifier les connexions SSH sans mot de passe en utilisant l'authentification par clé publique. Ssh permet aux utilisateurs de s'authentifier à l'aide d'un schéma de clé public-privé. Cela signifie que deux clés sont générées, une clé privée et une clé publique. Le fichier de clé privée est utilisé comme authentification, informations d'identification, et comme un mot de passe, doit être gardé secret et sécurisé. La clé publique est copiée dans les systèmes sur lesquels l'utilisateur veut se connecter, et est utilisé pour vérifier la clé privée. La clé publique n'a pas besoin d'être secrète. Un serveur SSH disposant de la clé publique peut lancer un défi qui ne peut être géré que par un système contenant votre clé privée. Par conséquent, vous pouvez vous authentifier en utilisant la présence de votre clé. Cela vous permet d'accéder aux systèmes d'une manière qui ne nécessite pas de taper un mot de passe à chaque fois, mais qui reste sécurisée.
Prohibit password authentication using SSHOnly allowing key-based logins to the remote command line has various advantages:
PasswordAuthentication no Customizing SSH Service ConfigurationThe OpenSSH server configuration fileWhile Open SSH server configuration usually does not require modification, additional security measures are available. Various aspects of the Open SSH server can be modified in the configuration file /etc/ssh/sshd_config. Prohibit the root user from logging in using SSHFrom a security stand point. It is advisable to prohibit the root user from directly logging in to the system with ssh.The user name root exists on every Linux system by default, so a potential attacker only has to guess the password, instead of a valid username and password combination. The root user has unrestricted privileges. PermitRootLogin no Configure Web Console |