Hey guys, I saw this in my VPS when checking history:
1 chmod +x /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
2 cat /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
3 vi /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
here is the content of the script:
# cat /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
swapoff /dev/vda2;mkswap /dev/vda2;swapon /dev/vda2;resize2fs /dev/vda1;yum -y update;systemctl disable guestfs-firstboot;reboot
This is a new server I provisioned on my VPS in racknerd. The command looks safe, but I’m wondering if these commands were executed on its own? Or someone has logged in to my VPS? This is also not normal, isn’t it?
Looks like stuff put in place by the VPS provider that would run on the first startup to create a swap partition and resize the main partition.
This looks like a provisioning command to expand disk to fill allocated space of your VPS.
From the location of that script usr lib virt-sysprep looks to be a script put in the image by the provided to do a few things on first boot. Would have thought it was normal, but you can always ask them to double check
I confirm that VPS companies use custom images with additional scripts. I’ve seen those a few times.
wait, the 3rd command is
vi
. I mean that’s not an automated script, it should be executed manually, right?I’d say they made the image, started it, did minor adjustments and didn’t delete the command history before stopping it and starting to deploy the image.
Looks harmless, although a tad sloppy.
Good point, what happens if you run that command ? It might also just left over from when they made the custom image and forgot to clean it all up ?
deleted by creator
Perhaps it is listed in reverse chronological order; edit, check content, change permissions (for deployment)?
good point, it’s just a test server for now so I’ll try to reinstall OS and check if same commands will show in history
i contacted support and they provided me this doc page
Remember to log out of the console, as I’ve personal experience of seeing someone at Racknerd type commands into it (presumably by mistake but possibly because that’s SOP - this was shortly before they shut down the server claiming it was responsible for a networking issue after being hacked. Never found evidence it was hacked but Linux can glitch from time to time. So it’s possible they were taking advantage of the fact I was looking at the console at the time to see what the state of the machine was and then realized I was watching.)
Note I’m referring to the console here, not random ssh sessions. While there may be technical ways for them to hijack those, there’s not a lot of point in doing so, there are easier ways to gain access to VMs via, say, backdoor passwords.
so what are the options for the customers like us if we don’t want them to access our server? how do i know if they logged in using a different method other than ssh?