# How not to install a new user...



## Phishfry (Dec 28, 2016)

I consider myself a new Unix user and I am just learning how to use user accounts. I recently made a rookie mistake by using the /root folder for a new user account for myself(instead of /home/user). This put all the .hidden files in /root in a state of disarray. So bad it was easier to just start over. Live and learn.


----------



## SirDice (Dec 29, 2016)

We all make mistakes. That's how we learn 

Biggest mistake I ever made was a misplaced `rm -rf *`. I _thought_ I was in /usr/ports, but it wasn't. It was /usr/. Was wondering why it was taking so long. Managed to break it off but not before it already nuked the whole /usr/local/ and, sadly, /usr/home. One thing I learned from that, I _never_ use `rm -rf *` anymore. I always provide the complete path, just to be on the safe side. 

Live and learn indeed


----------



## sizigee (Dec 29, 2016)

Trial and error 

I accidentally deleted the wrong partition, I wanted to wipe a flashdrive/pendrive/thumbdrive and ended up wiping the hdd.  The lesson learned was to triple check which partition to delete/recreate/resize...

Thank god there was a backup lol


----------



## SirDice (Dec 29, 2016)

sizigee said:


> I accidentally deleted the wrong partition, I wanted to wipe a flashdrive/pendrive/thumbdrive and ended up wiping the hdd.


As long as you didn't format the partition you could simply restore the original partition table. Contrary to popular belief removing a partition doesn't remove the actual data. But it does require entering the _exact_ same values. It's a good idea to back up the partition tables too. They're easy to export; `gpart backup ada0 > /tmp/part_table_ada0.txt`.


----------



## gkontos (Dec 29, 2016)

SirDice said:


> We all make mistakes. That's how we learn
> 
> Biggest mistake I ever made was a misplaced `rm -rf *`.



`rm -rf /`


----------



## scottro (Dec 29, 2016)

I did the /usr one too, in my first IT job.  Thank goodness it was a test machine.  This was back in the days when you first range chflag on /usr/obj to remove it before you built world.  I though, Gee, this is taking a long time.  Then, I did cd /usr/src to start buildworld, got directory not found, did pwd and saw /usr and said several bad words.    Again, thank goodness it was a test machine.


----------



## tingo (Dec 30, 2016)

As a new user, I had very good help by using the `echo` command. Before I did, say, `rm -rf somefile*`, I did `echo somefile*`, which shows all the files that would be affected.
HTH


----------



## Sevendogs (Jan 2, 2017)

SirDice said:


> Biggest mistake I ever made was a misplaced `rm -rf *`. I _thought_ I was in /usr/ports, but it wasn't. It was /usr/. Was wondering why it was taking so long. Managed to break it off but not before it already nuked the whole /usr/local/ and, sadly, /usr/home. One thing I learned from that, I _never_ use `rm -rf *` anymore. I always provide the complete path, just to be on the safe side.



I did something similar on Gentoo Linux once: took a couple of days building the system(old box, long ago) and copied my user's data from my backup drive to /home/paul then thinking I was in my home directory, ran `chown paul:paul /` as root. Was embarrasing I actually typed "/" and then hit enter (because "/" is at the top of your home directory, right?!) As you said SirDice "that's how we learn". Box was toast at that point and I started the multi-day rebuild all over again...sigh.


----------



## sizigee (Jan 2, 2017)

SirDice said:


> As long as you didn't format the partition you could simply restore the original partition table. Contrary to popular belief removing a partition doesn't remove the actual data. But it does require entering the _exact_ same values. It's a good idea to back up the partition tables too. They're easy to export; `gpart backup ada0 > /tmp/part_table_ada0.txt`.



This happened ages ago, though... I was still junior in the microsoft domain and ended up supporting a linux server (devops environment). I learned about it later though, and learned to double check the partitions before doing something like that again


----------



## TiberiusDuval (Jan 6, 2017)

For stupid mistakes here is one of my own. It happened some months ago. One of my operating systems in this big desktop machine is Windows 10. It was originally upgraded over older Windows 7. That was quite nice but it produced some issues. Like not being able easily to install various drivers, as Windows everytime complained about me not having enough rights to do so. I was only user of that machine and had full adminstrative account. The straw that broke camel's back was Windows anniversary update. It could not be installed. In any way. Then I got creative and with sheer stubbornnes convinced Windows to give my account full ownership of C:\Windows and its all subdirectories. Operation went through, and I was prompted to restart computer.  Windows did not boot successfully. It seems that Windows 10 really does not like any other but user "system" having ownership of C:\Windows. Even repair options did not work. 

I booted system to Linux and created USB-install medium from recent Windows iso-image. And then I did clean reinstall. But there is always silver lining in rain cloud. Previous rights issues vanished, and nowadays I can work with it without problems.


----------



## rigoletto@ (Jan 25, 2017)

Again, `rm -rf *` on my home directory deleting about 3TB of careful digitalized music, without backup yet. 

It happened about a year ago and until today I did not started to digitalize my collection again. The next time will be right after I manage to buy a Ultrium tape drive and transfer it to tape right after I digitalize anything.


----------



## Sevendogs (Jan 25, 2017)

Ouch


----------



## fscorrea (Feb 14, 2017)

I did `$ rm -f *` once (thank God there was no "-r") in $HOME. My intention was to run `$ rm -f *~` but accidentally entered without the trailing "~".
Starting that day my `ls` aliases all got a "-B" on Linux OSes. BSD `ls` does not have an option to ignore backup files so I still run `$ rm -f *~` every now and then. With extra care.


----------



## SirDice (Feb 14, 2017)

One of the things I learned, csh(1) has a handy option (although I find it rather annoying), `set rmstar`:

```
rmstar (+)
               If set, the user is prompted before `rm *' is executed.
```


```
dice@molly:~/temp % touch test1.txt
dice@molly:~/temp % touch test2.txt
dice@molly:~/temp % touch test3.txt
dice@molly:~/temp % touch test4.txt
dice@molly:~/temp % 
dice@molly:~/temp % ll
total 2
-rw-r--r--  1 dice  dice  0 Feb 14 11:03 test1.txt
-rw-r--r--  1 dice  dice  0 Feb 14 11:03 test2.txt
-rw-r--r--  1 dice  dice  0 Feb 14 11:03 test3.txt
-rw-r--r--  1 dice  dice  0 Feb 14 11:03 test4.txt
dice@molly:~/temp % rm test1.txt 
dice@molly:~/temp % rm *
dice@molly:~/temp % set rmstar
dice@molly:~/temp % touch test1.txt
dice@molly:~/temp % touch test2.txt
dice@molly:~/temp % touch test3.txt
dice@molly:~/temp % touch test4.txt
dice@molly:~/temp % 
dice@molly:~/temp % rm *
Do you really want to delete all files? [n/y] y
dice@molly:~/temp %
```


----------

