Hello once again. In this post I will go through on how to say “Hello World” in 2 different programming languages and how to install OpenSSH plus setup a user for it. So let’s begin!
Part 1: “Hello World”
With almost every distribution of Linux there is a programming language called python included within. This is one of the easiest programming languages available today (but is still a advanced and powerful language) and we’ll be using it as one of the languages to say “Hello World”.
As with any program that is included or installed through apt-get, we simply need to open the console and type the name of the program to launch it. In this case it would be
, but we want to make a simple file that says “Hello World”.
Open the terminal and type
. The file will open when you hit enter and now we are inside editing it.
As we are creating a simple file, we won’t need to put anything fancy inside of it. We called it test.py which means that it automatically understands that it’s a python file. We only need to type these commands to get it to say “Hello World” and then exit:
print "Hello World" exit(0)
Press ctrl+O and hit enter to save the file. Now just hit ctrl+X and you are ready to test the file. type
Now let’s use shell scripting to say “Hello World”. Bash isn’t really a good programming language, but instead a shell script that is designed to make the typing of many short/long commands faster instead of having to type them every single time again.
Bash uses the same principle, so let’s make a new file with nano called test.sh. Type:
and hit enter
echo "Hello World" exit
Now save the file as you did for the python file and exit. To run a bash file we simply need to type
and it will run the file. Do it now.
But wait! It says “Permission Denied”, what kind of sorcery is this?! No worries, we simply need to give ourselves the right to run this specific .sh file without sudo. Type:
chmod ugo+x test.sh
and now try running it again! See, it’s showing “Hello World” now!
And there you have it! “Hello World” said through 2 different programming languages.
Part 2: Installing OpenSSH and creating a user
Now it’s time to install OpenSSH and add a user to it. First type
sudo apt-get install openssh-server -y
and let it install.
After installing we need to create a user to even have any use of the SSH server. To create a user we simply type:
sudo adduser foobar
Give the user a GOOD password and re-type it. Add any extra info if you want and press Y and then enter when asked to confirm the creation of the user. You now have a user called foobar.
We are only a couple of steps away from being done. Now we just need to connect to foobar through ssh!
First we need our IP address. To find it type
. After finding the IP address we only need to type this in the terminal to connect to foobar using the ssh method. Simply type:
and hit enter. Type the password you had created earlier and now you are inside the home folder of user foobar.
Congratulations! You now have learned how to write “Hello World” in 2 different languages and how to setup a basic SSH server + how to create a new user in a Linux environment.
Thanks for reading, and as always; Thank you!