In part one of this series we discussed bash scripting, and how it can help accelerate your development time. We continue with part two, focusing on SSH connections and remote desktop capabilities.
Enable a SSH server on Fedora 17 and control your system remotely via an SSH terminal.
A. What is an SSH connection?
The SSH protocol is used to establish an encrypted connection with another computer. It is mainly used to access a computer remotely or securely transfer files between the computers. As specified by its name, the SSH protocol is designed to remotely provide access to another computer through a “Secure SHell” or, in other words, a command line interface, which is perfect for systems running Linux/Unix. When the SSH port is configured, the remote computer could then be accessed using any traditional terminal such as PuTTY.
The screenshots below show a connection using PuTTY to a Fedora 17 embedded computer:
B. Steps to setup the SSH server on a Fedora 17 Operating System
The following presents the easiest way I found on the Internet to configure an SSH server on Fedora 17. It allows easy connection to your system via ssh without managing users and permissions. (Note, a configuration bash file is provided after the instructions).
1. Start and log to your Fedora-based computer.
2. Ensure your computer is connected to the internet.
3. Open a command line terminal and log in as root (use command “su” and enter “root password”).
4. Launch the following commands:
a. Install openssh :: “yum -y install openssh-server”
b. Launch the ssh server :: “/sbin/service sshd start”
c. Verify the service is active :: “/sbin/service sshd status”
d. Configure the file system to launch the ssh server on startup :: “chkconfig sshd on”
e. Launch the firewall configuration panel :: “system-config-firewall”
f. The previous step will launch a GUI interface of the Firewall configuration panel. Perform the following steps to allow connection to port 22 tcp SSH:
i. Go in “trusted service” tab
ii. Search for the ssh service : “SSH, 22/tcp”
iii. Check the box and click “Apply”.
iv. Close the firewall configuration panel.
At this point, you should be able to connect via SSH to your Fedora system from another PC. Ensure the computer has the same network subnet (e.g. 192.168.0.X) of your PC computer and use PuTTY to establish a connection at the IP address of your computer (see picture above). It is recommended to set a static IP address to the Fedora system, so you will know the IP address to use to target a specific PC from your network.
To complete this section, as a simple example of bash script usage, you could download and execute the bash file to install and setup the openssh server on your system. To execute the bash script, open a terminal, log in as root (cmd: su), go in the directory where the bash file is copied (cmd: cd /directory/where/bashfile/is/located) and use the command “bash install_ssh_server.sh”
· Downloadable content: https://nutaq.com/sites/default/files/blog-downloads/install_ssh_server.sh
Configure your Fedora 17 to allow a Remote Desktop Connection from a Windows PC station.
A. What is the Remote Desktop Connection in Windows?
The Remote Desktop Connection is a Windows application that also allows connection to a remote computer. In contrast to the SSH connection, the Remote Desktop Connection provides a graphical access to the remote computer and to all its programs, files, and network resources as though you were in front of its screen monitor.
The following picture shows a screenshot of a Fedora 17 desktop through the Remote Desktop Connection:
B. Steps to setup the Remote Desktop Service on a Fedora 17 Operating System
The following presents the steps I found on the Internet to create a Remote Desktop Connection between my Windows PC and my Fedora 17 embedded system. (Note, a configuration bash file is provided after the instructions).
In Fedora 17 (Linux):
1. Start and log in to your Fedora-based computer.
2. Ensure your linux computer is connected to the internet.
3. Configure your system with a static IP address.
4. Open a command line terminal and log in as root (use command “su” and enter “root password”).
5. Launch the following command:
a. Install TigerVNC :: “yum -y install tigervnc-server”
b. Install xrdp :: “yum -y install xrdp””
c. Enable xrdp service :: “systemctl enable xrdp.service”
d. start xrdp service :: “systemctl start xrdp.service”
e. Verify the service is active :: “systemctl status xrdp.service”
f. Launch the firewall configuration panel :: “system-config-firewall”
g. The previous last step will launch a GUI interface of the firewall configuration panel, perform the following step to allow connection of port 3389 tcp ms-wbt-server:
i. Go in “Other port” tab
ii. Click “Add”
iii. Add port: “3389 tcp ms-wbt-server”
iv. Click “Apply”.
v. Close the firewall configuration panel.
6. Start the application “Remote Desktop Connection”
7. For Computer, enter the “IP address” (e.g. 192.168.0.102) of your Fedora system.
8. It then leads you to a splash screen of xrdp service; enter your fedora login and password.
9. Enjoy, you should now be in your fedora desktop.
Finally, again, as a simple example of bash script usage, you could download and execute the bash file to install and setup the xrdp service on your Fedora 17 system. To execute the bash script, open a terminal, log in as root (cmd: su), go in the directory where the bash file is copied (cmd: cd /directory/where/bashfile/is/located) and use the command “bash install_xrdp_service.sh”.
· Downloadable content: https://nutaq.com/sites/default/files/blog-downloads/install_xrdp_service.sh
I hope you have appreciated this initiation to bash scripting and you will benefit from the provided examples, and be able to SSH or use the remote desktop connection on your Fedora (linux) system.