Uputstva za VPS (Debian, SSH, rescue)

Na engleskom, za Debian VPS, ne koristim srpsku IT terminologiju i ne koristim Windows

🖥️1. How to connect to my server?

You can connect to your server using SSH for your local Linux or Remote Desktop (RDP) for your Windows with the IP address and login data sent in your email. Find your IP address, username (usually root for Linux), and port (22 for SSH) in the "Vaši login podaci!" email from Danguba VPS.

Windows, macOS, or Linux: Open your terminal application (Secure Shell (SSH) on Linux or PowerShell/Command Prompt on Windows). Type the command: ssh root@YOUR_SERVER_IP for example:
ssh root@111.22.333.60
Type yes to accept the security fingerprint on your first connection, then you will be asked for password.

Windows users can also download an SSH client like PuTTY or if it is already installed: Windows Start menu - All Programs - PuTTY - PuTTYgen. Here is the video how to generate ssh keys with PuTTYgen:
https://www.youtube.com/watch?v=-92wEg68SKQ

Anonymous login: proxychains4 ssh root@111.22.333.60 (you must install tor and proxychains4 for this)
With changed port on the server: ssh -p 12345 root@111.22.333.60
Anon+port+keys: proxychains4 ssh -p 12345 -i ~/.ssh/myvps/id_ed25519 root@111.22.333.60

First thing you should always do when you get new server/installation, when you login:
sudo apt update && sudo apt upgrade

You can also use Filezilla to upload/download/edit files from your server.

🧅2. How to install tor and proxychains4 on my local Linux?

sudo apt update && sudo apt -y install tor proxychains4 && sudo systemctl enable tor && sudo systemctl start tor
To change proxychains4.conf you should be sudo, if you have mouspad text editor or vim or nano:
sudo mousepad /etc/proxychains.conf
remove # from dynamic_chain and put # in front of strict_chain and write socks5 instead of socks4 in the last line: socks5 127.0.0.1 9050
close mousepad or nano or vim whatever editor you used.

sudo systemctl restart tor
Now you can login to your server anonymously with Tor IP:
proxychains4 ssh root@111.22.333.60

🗄️3. How to change ssh port on my server?

If you are beginner better use Filezilla for this, here are terminal commands after you login:
cd /etc/ssh
sudo nano sshd_config

change port as you want instead of 22:
Port 11111
# scroll down and make this, if you want to prevent log out because of inactivity:
ClientAliveInterval 60
ClientAliveCountMax 10


close nano (ctrl+o then enter then ctrl+x) and restart ssh:
sudo systemctl restart ssh

now try ssh from local:
ssh -p 11111 root@111.22.333.60
In theory if it is not working, maybe your local network allows you only web ports 80, 443, but not 11111. It depend from which network you want to login.
In such case, change back to 22 and restart ssh again until you find out what is problem.

🔑4. How to install locally ssh keys and use it for login?

Open your Linux terminal, you can write email or simply "MyVPS" whatever you want:
mkdir ~/.ssh
mkdir ~/.ssh/myvps
ssh-keygen -t ed25519 -C "MyVPS" -f ~/.ssh/myvps/id_ed25519

Enter passphrase 2 times.
You will get notification:
Your identification has been saved in /home/user/.ssh/myvps/id_ed25519
Your public key has been saved in /home/user/.ssh/myvps/id_ed25519.pub
The key fingerprint is:
SHA256:O7vwU.................... MyVPS

Public key is the one you should copy to your server, but before that, set the key permissions.
sudo chmod 700 ~/.ssh
sudo chmod 600 ~/.ssh/myvps/id_ed25519
sudo chmod 644 ~/.ssh/myvps/id_ed25519.pub


And now get the key you should copy paste with terminal or Filezilla to your server:
sudo cat ~/.ssh/myvps/id_ed25519.pub
It will look something like:
ssh-ed25519 AAAAC3.......................... MyVPS

Add the public key to your server, login via SSH or Filezilla but you need ssh for permissions:
Edit the authorized_keys file:
nano ~/.ssh/authorized_keys
Paste the public key you copied as a single line.
Save and exit (ctrl+o then enter then ctrl+x).
Set correct permissions:
chmod 600 ~/.ssh/authorized_keys
sudo systemctl restart ssh

Test SSH login: ssh -i ~/.ssh/myvps/id_ed25519 root@111.22.333.60
Note: to avoid to type million times long command, you can make alias in .bashrc or .zshrc conf file of your local terminal: alias myvps='ssh -i ~/.ssh/myvps/id_ed25519 root@111.22.333.60'
close editing and refresh terminal: source ~/.zshrc or source ~/.bashrc
then you just type myvps in your terminal and you dont need to type long command to login to your server.

So, after testing ssh keys login, if it is OK, go back to your server terminal and Pubkey should be YES and passwd login NO:
cd /etc/ssh
sudo nano sshd_config
PubkeyAuthentication yes
PasswordAuthentication no

Close nano and restart: sudo systemctl restart ssh

Now bruteforce of your ssh password will be loosing time for the attacker.

If you want to change ssh key password, you do it in your local terminal:
ssh-keygen -p -f ~/.ssh/myvps/id_ed25519
type old and new password...
The passphrase only encrypts your local private key file.
You do NOT need to upload a new public key to authorized_keys on the server.
You do NOT need to create a new .ppk for FileZilla (unless you want to). If you want, type load/old and save/new password after command below.

If you want to make .ppk file for filezilla ssh keys login, use this command in your local terminal:
cd ~/Desktop
puttygen ~/.ssh/myvps/id_ed25519 -O private -o myvps.ppk

You will be asked for keys password and you will get .ppk file in your Desktop folder.
Then you need to import that file in Filezilla when you want to login to your server.
If you want sometimes to change the passphrase of .ppk file: puttygen myvps.ppk -P

🔐5. How to reset your server password?

If you forgot password, you can use VNC client or you can send me a message with email or contact form to make new passwd for you and then you can login and change it.
If you know password and you want to change it, after login to server:
passwd root
Type new password 2 times.

🚑6. How do I boot a rescue system for my server?

A rescue system allows you to partially access your server and fix any problems that may be preventing you from accessing it normally. It allows you to access the system, make changes, fix errors, repair corrupted files or back up critical data and reboot the system normally.

Send me email that you need rescue system and I will start it and send you root password, port is 22.

1. after you login, make sure you have admin rights: sudo -i
2. check which partitions are available: fdisk -l
3. The root file system is usually located on /dev/sda2 or /dev/vda2. Use the following command to mount the partition: mount /dev/sda2 /mnt/
4. Your server files are now available in /mnt/
5. modify configuration files or whatever you need to do.
6. When you have finished your work, boot your server normally again: reboot

🚑7. How do I change the partition layout of my Linux server?

Boot the rescue system for your server.
Connect to the server using VNC.
Log in to the server as the "root" user.
To easily make changes to the partition, use gparted.
To start the GUI, type "startxfce4" in your VNC console and wait a few seconds until the graphical interface appears.
On the upper left side you will see “Applications”, open it.
Select “Run Program”.
Now type “gparted” into the application finder and the application should start immediately.
You should see a list of all the partitions on your hard drive. If there is no free space, you will need to shrink an existing partition before you can create a new one.
To do this right click on the partition and select “Resize/Move”, the partition can be either shrunk or extended.
Right-click on the unallocated space and select “new” to create a new partition.
To write the changes to the disk, click the green check mark.
After clicking the checkmark, a warning will appear that you may lose all your data - make sure you have a backup before proceeding.
The application should start performing several tasks, just wait for it to finish and then reboot.

🚑8. I have performance issues with my server, what should I do?

1. Check CPU usage: Log into your server and run top on Linux. Check for any process consuming an unusually high percentage of CPU. If one process is consistently above 80–90%, it might be slowing your server down.
2. Check the Memory section: If swap usage is high, your server has run out of physical RAM and is using disk space as overflow. Disk is slower than RAM, causing the server to be slow. Consider closing unused applications.
3. Check disk activity: Monitor Disk I/O (Input/Output) with “iotop” and Process Details with “htop”: iotop: Focus on which processes are causing the most disk read/write activity, checking if it aligns with expected disk usage. htop: An enhanced version of top with a more intuitive interface, providing detailed views of processes, CPU cores, and memory usage.
4. Check your network connection: check with your local internet provider for any known problems in your area. You can also run the following command on your machine and look for any hops with high response times or timeouts: traceroute <your-server-IP>
If delays appear early in the list, the issue is likely with your local network or ISP. If they appear later, it may be closer to the server.
5. Review system logs: /var/log/syslog. Check your system logs for errors or warnings around the time the slowdown started - these can reveal hardware issues, failed services, or misconfigurations.
-- If you ask for help, dont forget to explain: When did the issue start? Which applications or services are affected? Screenshots or output from the steps above (CPU, memory, disk usage), traceroute your-server-IP