## Generate Private Key openssl genrsa -out private-key.pem 8196 ## Generate Public Key using above Private Key openssl rsa -in private-key.pem -out public-key.pem -outform PEM -pubout ## Encrypt a file named file.txt to a file named file.txt.encrypted openssl rsautl -encrypt -inkey public-key.pem -pubin -in file.txt -out file.txt.encrypted ## Dectrypt an encrypted file named file.txt.encrypted to a file named file.txt.decrypted openssl rsautl -decrypt -inkey private-key.pem -in file.txt.encrypted -out file.txt.decrypted
You know those handy shortcuts in Windows where you use the Windows Key + Left or Right and the window you’re working in automatically snaps to the left or right? Well, they exist in Ubuntu Unity as well and it’s awesome!
Sometimes you might need to test whether a specific port is open in Linux based on your firewall rules. Without having to install specific software (e.g, telnet server for port 21) you can test this using netcat.
This can be handy if you need to prove to a service provider that they are blocking your ports.
Example, port 21
On the server side:
For ports under 1000 you must be root/sudo user
sudo netcat -l 21
On the client side
netcat [server ip] 21
It will look like nothing has happened. On the client side, just type some random words, e.g. “Hello World!” and hit [ENTER]. If the connection was successful, you should see the same words echoed on the server side.
To end the session you can either use CTRL+C on the server side (will kill both sides) or CTRL+D on the client side (will only kill the client side)
Check out this quick video on how to enable auto login via SSH on linux. The two hosts in the video are Ubuntu 14.04 hosts.
To concatenate multiple media files use avconv as follows:-
avconv must be installed
avconv -i concat:"file1.avi|file2.avi|file3.avi" -c copy all.avi
In this day and age, you need your machines to be up and running 100% of the time, or as close to that as possible. This means that rebooting a server just to get some detail about your RAID configuration is completely out of the question.
Luckily, some RAID cards have the ability to be configured even from a running system. In the case of this article, we’re looking at LSI or PERC (As the Dell guys call them) cards.
To resize all the JPEG files in a directory so that one of the dimensions is maximum 800 pixels.
The \> implies that the images will only be made smaller, never bigger
ImageMagick must be installed
mkdir tmp for file in `ls *jpg`; do echo $file; convert $file -resize 800x800\> tmp/$file; done
To install VMWare tools using YUM on CentOS/RHEL 6.5, do the following.
Note, I’m logged in as the ‘root’ user, but you could execute these commands using ‘sudo’ as well.
Step 1: Download and import GPG keys
[root@techedemic /var/tmp]# wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub [root@techedemic /var/tmp]# rpm --import VMWARE-PACKAGING-GPG-RSA-KEY.pub
Step 2: Add VMWare repository
# Create/Modify /etc/yum.repos.d/vmware-tools.repo, I use 'vim' as an editor [root@techedemic /var/tmp]# vim /etc/yum.repos.d/vmware-tools.repo
Please see Connect via RDP to Ubuntu 14.04 using XRDP for an updated version of this post.
If you need to connect to a Linux machine, and in the scope of this guide, Ubuntu 13.10 (I’m sure this guide should be fine for earlier versions as well), then your options include:
- Pure and simple SSH – The admin’s super tool! (just install openssh-server – works every time!)
- VNC – I don’t like this method because you need to install software on your client AND server
- XRDP – This still involves VNC to some degree but you can use the normal Windows Remote Desktop Client
The latter is the one I’ll guide you through here. Continue reading