So today i was learning a bit of linux using my linux ubuntu 20.04, i was learning about autofs. I installed autofs and configured it as was shown on the video i was watching. So it was time to create a user on ubuntu device that i presume is used to connect two machines so that they can share the shared files/filesysyem as i had to also create the same user eith the same userid on my other linux device.
So i then went on to create my new user called "user1" using the 'useradd'command, but when i tried to login to this user i noticed that as my prompt im only getting the $ sign, instead of (uname)@(hostname)$, so i thought to myself maybe its because i did not set the home directory for the new user, so i then executed the following command 'chmod -s /bin/bash -m -d /home/user1/ user1' (note that i was in my main home directory when i executed this command. The main directory of which i lost all my data). So after executing this command i was then able to login to user1 and the command prompt was actually correct. But then i immediately noticed that when i logged into that user i was in the /root home directory.
When i tried to ls my main home directory i was getting nothing back, so i then momentarily exited my terminal and tried to access my files using my gui and i noticed that i had no more files in my computer, i thought maybe it was just an error i could reslove by restarting my computer, but when i restarted it i could not login as myself nor as root, when i try to login as myself i get stuck in a login loop, when i try to login as root it doesnt allow me either, i even tried password recovery and it still wont allow me to login. On the login screen when i access the tty3 it allows me to login as myself and as root but under my home directory my data seems to be losy forever.
Can someone please help me to login to my computer at least, the data i have lost can mostly be recovered but at this moment i cant even access my GUI
chmod -s /bin/bash ...
? I'm not sure, but get a live boot usb stick, mount your rootfs, and do achmod 755 /mnt/bin/bash
. With some luck your old system should now work again. – paladin Apr 21 '22 at 15:01/mnt
. And also do achmod 755 /mnt/usr/bin/bash
. – paladin Apr 21 '22 at 15:06adduser
is more user friendly thanuseradd
. The reason you were seeing only$
is because you were using the wrong shell.useradd
also doesn't create a home directory unless you tell it to. Now you might have broken your system in the actions you have taken. I suggest that you reinstall and restore from backups. Try to research commands before running them so that you don't make mistakes as frequently and always have backups in case you need to start over. See: https://askubuntu.com/a/345986 and https://serverfault.com/a/267101 – Nmath Apr 21 '22 at 18:09