-1

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

Lihle
  • 1
  • 1

1 Answers1

-1

So basically i heavent solved the whole problem completely, but i have a solution which is just as good. So with the use of testdisk through tty3 i was able to enter the /home/(USER) directory and copy everything to a created directory /backups. I then went on to delete all Usernames from the /etc/passwd, /etc/shadow & /etc/group directory.

Then i created a new directory /Home/(User) where i copied all the files from /backup to, i then proceeded to create a user using "useradd" command because for some reason it wasnt allowingg me to use "adduser". After creating the user i used "usermod" to set the home directory for the new user, after that i went to /etc/passwd to set the shell to /bin/bash for the user. I then rebooted my computer and i was able to use ny computer as normal.

My only issue is that i still cant access my /home directory and it taking up about 66g of my storage space...

Lihle
  • 1
  • 1