Wiki (Archived) | Linux Club at UMD

Back to main page

Turn Caps Lock into Ctrl

Add this line to your ~/.profile file and log out and back in:

setxkbmap -option "shift:both_capslock,caps:ctrl_modifier"

Caps lock will act as Ctrl, and if you press both Shift keys at the same time, it will toggle caps lock.

Bonus: Swap Home/End with Page Up/Down

If you have a keyboard with page up/down keys next to your arrow keys but find that you never use them, you can swap them with home and end so it is easier to quickly jump to the beginning and end of a line when editing text.

Just edit this file with sudo nano /usr/share/X11/xkb/symbols/pc and change the following section:

    key <HOME> {    [  Home         ]   };
    key <PGUP> {    [  Prior        ]   };
    key <DELE> {    [  Delete       ]   };
    key  <END> {    [  End          ]   };
    key <PGDN> {    [  Next         ]   };

to look like this:

    key <HOME> {    [  Prior        ]   };
    key <PGUP> {    [  Home         ]   };
    key <DELE> {    [  Delete       ]   };
    key  <END> {    [  Next         ]   };
    key <PGDN> {    [  End          ]   };

Congrats! You have boosted your productivity by 9000%!

Reset Linux Password with Live USB and Chroot

Create a linux live USB drive. Shutdown the computer that you forgot the password to. Plug in the live USB and boot up, interrupting the sequence to get to the BIOS. Once the live USB boots, mount the computer's drive by opening the file manager and clicking on the drive. Right click on the folder where it was mounted and click "open in terminal." Run the following command to enter a chroot environment as if you were logged into the computer you forgot the password to:

chroot .

In the new environment, change the password of the user you want:

passwd yourusername

You can also change the root password:


Then reboot the computer and log in with your new password!

Accessing a server with no public IP


There is a computer that does not have a public IP that I want to make accessible for remote ssh login. This is machine A. I am logging in from a random machine B that could be anywhere in the world. Machine C is a public server that I have access to.

Setup the public machine

I create a user on machine C called fwd Then I add the following line to /etc/ssh/ssh_config on machine C:

GatewayPorts yes

On the machine without a public IP

Don't forget to start the ssh server on machine A (may already be running):

user@machineA:~$ sudo systemctl enable sshd
user@machineA:~$ sudo systemctl start sshd

Then I can run this command on machine A to connect it's local ssh port to machine C's port 8000:

user@machineA:~$ ssh -R \*:8000:localhost:22 fwd@machineC

Logging in remotely

To log in, execute on machine B to log into machine C:

user@machineB:~$ ssh fwd@machineC

Then execute on machine C to log in to machine A:

fwd@machineC:~$ ssh user@localhost -p 8000

Congratulations! You are now logged in to machine A from machine B anywhere in the world.

user@machineA:~$ nyancat

Credit to this serverfault post for the original process.

Turning Debian into Kali

A brain-dump of the commands I used to convert a debian virtual machine to kali.

sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/qubes-r4.list
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoremove
git clone
sudo cp katoolin/ /usr/bin/katoolin
sudo chmod +x /usr/bin/katoolin
rm -rf katoolin
sudo katoolin
  #select 1, then 1 and 2 (add repos and update)
  #Ctrl-C to quit katoolin
sudo apt-get dist-upgrade
sudo apt-get autoremove
  #need at least 32GB disk space (increase size if in a VM)
sudo nano /etc/apt/sources.list
deb kali-rolling main contrib non-free
# For source package access, uncomment the following line
# deb-src kali-rolling main contrib non-free
deb sana main non-free contrib
deb sana/updates main contrib non-free
# For source package access, uncomment the following line
# deb-src sana main non-free contrib
# deb-src sana/updates main contrib non-free
deb moto main non-free contrib
# For source package access, uncomment the following line
# deb-src moto main non-free contrib
sudo katoolin
  select 2 and install everything
sudo apt autoremove --purge shashlik thunderbird texstudio xzdec perl-tk texlive texlive-latex-base texlive-latex-extra texlive-latex-recommended
apt autoremove