RSA (Rivest–Shamir–Adleman) is a widely used public-key cryptosystem that is used for secure communication over the internet. In this post, we will explore how to generate a pair of RSA private and public keys in Linux using the OpenSSL library. Generating a pair of RSA private and public keys in Linux using OpenSSL is a
Read more
Category: QA
Questions and answers.
How to generate a pair of SSH private key and public key pairs?
Posted onHow to generate a pair of SSH private key and public key pairs? On Linux, you can generate one first by $ ssh-keygen -t rsa By default on Linux, the key pair is stored in `~/.ssh` named `id_rsa` and `id_rsa.pub` for the private and public key.
How to cat a text file out from a tar archive without having to extracting it?
Posted onHow to cat a text file out from a compressed tar archive package without having to extracting the whole package? For example, I have a pkg.tar.gz which contains a text file pkg/readme.txt in it. How to cat the pkg/readme.txt file content out? You may use this command to cat out the file content: tar -O
Read more
How to mirror a website using wget on Linux?
Posted onHow to mirror a website using wget on Linux? If the command can filter only specific file extensions, such as pdf and docx, it will be much better too. To download all PDF files from https://example.org/path/ as an example, you may use this command: wget –mirror \ –convert-links –no-parent –quiet \ –adjust-extension -A pdf \
Read more
How to write to remote side with sudo in rsync?
Posted onHere is the case, the user can not write directly to the remote side’s directory, while the user can sudo on the remote side and write the directory with sudo. How to write to remote side with sudo in rsync? On the source machine, run the rsync command with –rsync-path="sudo rsync" added. For example, rsync
Read more
How to write file content with sudo in Vim?
Posted onVim opens file even if the user does bot have write permission to the file. But after revision, how to write file content with sudo in Vim if Vim reports no permission to write the file. Use this command inside of vim to write to the file with sudo: :w !sudo tee % Here, !
Read more
How to rename a branch name in the remote git server?
Posted onHow to rename a branch name in the remote git server? For example, I made a mistake to push a branch named ood-name to the git server while I intended to name it old-name. How to rename the branch name ood-name on the remote git server? You may change the remote git server’s branch name
Read more
How to enable user themes in Ubuntu 18.04?
Posted onThe way for Ubuntu 17 to installing the gnome-shell-extensions package does not work any more for Ubuntu 18.04. How to enable user themes in Ubuntu 18.04? The updated gnome-shell-extensions package actually adds the User Theme extension back. You can use that. First, install the package sudo apt install gnome-shell-extensions Second, log out and login again
Read more
How to get date and time using date command from another timezone in Linux?
Posted ondate command on Linux gets the date and time in the system timezone. But how to get date and time using date command from another timezone in Linux? You can make date print the time of another timezone by setting the TZ environment variable. For example, export TZ=Hongkong; date Sat Dec 1 09:39:13 HKT 2018
Read more
Fixing the huge emoji icons in Unbuntu 18.04 for Thunderbird
Posted onIn Ubuntu 18.04, Thunderbird shows huge emoji icons in the email list. The emoji covers other text and is several lines higher and wider than other charactors. How to solve it? This is likely caused by the fonts. Find out the *emoji* fonts installed in your system by sudo apt list *emoji* and remove those
Read more
How to change the logo shown during booting in Ubuntu?
Posted onHow to change the logo shown during booting in Ubuntu? I originally installed Ubuntu MATE 18.04. But I am using GNOME 3 now by replacing the DE. But the log shown during booting is still Ubuntu MATE’s. How to change it to another one? It is plymouth the application that manages the “splash” screen during
Read more
GNOME 3 "Natural scrolling" mouse option does not work
Posted onIn GNOME 3 “Settings” -> “Devices” -> “Mouse & Touchpad”, after setting “Natural scrolling” to On, the scrolling is still as the same before (non-natural). How to fix this? This is likely related to the X11 driver. Remove the xorg-x11-drv-synaptics driver if it is installed. And install the xorg-x11-drv-libinput driver if it is not installed.
Read more
How to install GNOME 3 in Ubuntu MATE 18.04?
Posted onHow to install the GNOME 3 (gnome-shell) desktop environment in Ubuntu MATE 18.04? To install gnome3 to Ubuntu, install these packages sudo apt install gnome-session gdm3 ubuntu-desktop During installation, the installation tools will let you choose the default display manager. You may choose gdm3. Then reboot you Ubuntu Linux and gdm3 will be shown. Click
Read more
Installing Zlib from Source Code in Ubuntu Linux
Posted onZlib is a popular open-source compression library used by many software applications to compress and decompress data. While it can be installed in Ubuntu using the apt package manager, you may need to install it from the source code if the version available in the Ubuntu repositories is outdated or if you need to customize
Read more
How to add Chinese input method to Unbuntu 18.04?
Posted onHow to add Chinese input method, such as Pinyin, to Unbuntu 18.04? To input Chinese, first install an input method framework. Here, we use fcitx. Then you need to input the Pinyin input method. You may use fcitx-sunpinyin. Put them all together $ sudo apt-get install fcitx fcitx-sunpinyin After that, set the default input method
Read more
File system Inode flags: difference between FS_IOC_GETFLAGS and FS_IOC_FSGETXATT
Posted onWhat is the difference between FS_IOC_GETFLAGS and FS_IOC_FSGETXATTR ioctl commands? What flags do both return? The comment in fs.h is clear enough to explain itself. In short, FS_IOC_GETFLAGS was for ext2/ext3 only, and FS_IOC_FSGETXATTR is a generic FS level interface. Full comment as follows for your reference (source): /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
Read more
Port forwarding on local host
Posted onI am trying to forward UDP port 500 to 2500 on local host, but can’t get this to work – I have run: iptables -t nat -A PREROUTING -p udp -d 192.168.1.10 –dport 500 -j DNAT –to-destination 192.168.1.10:2500 iptables -A FORWARD -p udp -d 192.168.1.10 –dport 2500 -j ACCEPT where 192.168.1.10 is the IP of
Read more
System Call Tracking without ptrace,strace,etc.
Posted onHow could I log system calls made by another process without using current built in functions like ptrace, strace, audit etc. I think two options are intercepting the system call table, and another is modifying the entry_64.s file. I want to output these system calls to a file. Can’t find any suggestions on this anywhere.
Read more
Call a Function by Its Name as a String in PHP
Posted onIn PHP, it is possible to call a function by its name as a string. This can be useful when the name of the function is not known until runtime, or when the name of the function is stored in a variable or retrieved from a database or other external source. To call a function
Read more
gdb like step by step debugger for Python
Posted onAny good debugger for Python that is like gdb so that the code can be executed step by step for debugging purpose? You might check pdb. You can debug a program such as prog.py by invoking it through pdb: python -m pdb prog.py Common gdb commands can be found in pdb: (Pdb) h Documented commands
Read more