1

This is what happened:

root@rasp:~# ls -al
total 72
drwx------  8 root root 4096 Jan 22 21:01 .
drwxr-xr-x 25 root root 4096 Sep 11 14:27 ..
-rw-------  1 root root 8079 Jan 22 19:55 .bash_history
-rw-r--r--  1 root root  570 Jan 31  2010 .bashrc
drwx------  3 root root 4096 Jul 31 16:28 .config
drwxr-xr-x  2 root root 4096 Jan 21 15:18 misc
-rw-r--r--  1 root root  140 Nov 19  2007 .profile
-rw-r--r--  1 root root  204 Jan 22 21:01 psk-01.cap
-rw-r--r--  1 root root  236 Jan 22 21:01 psk-01.csv
-rw-r--r--  1 root root  325 Jan 22 21:01 psk-01.kismet.csv
-rw-r--r--  1 root root  227 Jan 22 21:01 psk-01.kismet.netxml
-rw-------  1 root root 1024 Jul 29 13:26 .rnd
drwxr-xr-x  5 root root 4096 Jan 19 15:51 .rpi-firmware
drwxr-xr-x  2 root root 4096 Sep 10 08:45 scripts
-rw-------  1 root root  259 Aug  1 14:04 .sqlite_history
drwx------  2 root root 4096 Nov  5 02:05 .ssh
root@rasp:~# rm psk *
rm: cannot remove `psk': No such file or directory
rm: cannot remove `aircrack': Is a directory
rm: cannot remove `misc': Is a directory
rm: cannot remove `scripts': Is a directory
root@rasp:~# rm psk * -f
rm: cannot remove `aircrack': Is a directory
rm: cannot remove `misc': Is a directory
rm: cannot remove `scripts': Is a directory
root@rasp:~# rm psk * -fR

I wanted to put rm psk* but got a blank space in it.

Is there any way I can rebuild the bash, config, profile, rnd, rpi-firmware, ssh folders and files?

slm
  • 7,355
  • 16
  • 54
  • 72
Daniel W.
  • 1,439
  • 4
  • 23
  • 46

2 Answers2

4

You can and should restore it from backup.

MDMarra
  • 100,183
  • 32
  • 195
  • 326
  • 1
    +1. Either learning or seeking a job ouside system administration are likely good ways to go forward - better do something that dumb (according to your own words) not again ;) – TomTom Jan 22 '14 at 20:10
  • That's sorta true.. – Daniel W. Jan 22 '14 at 20:12
0

The following commands will re-copy the standard files that a newly setup account gets.

$ cd /etc/skel
$ cp .* /root/
slm
  • 7,355
  • 16
  • 54
  • 72
Daniel W.
  • 1,439
  • 4
  • 23
  • 46
  • This doesn't really rebuild it, just restocks the directory with the standard set of files that a newly created account would get. – slm Jan 22 '14 at 20:32
  • That's what I thought too, and also `/etc/skel/.ssh/id_rsa` does not exist, it has recoverd ?! How is this possible? – Daniel W. Jan 22 '14 at 20:38
  • Oh maybe `rm * -fR` does not delete `.`hidden files? – Daniel W. Jan 22 '14 at 20:39
  • When you ssh into the system that directory get's automagically created. Without backups you're screwed. The file `id_rsa` is your public/private key pair (the private part). – slm Jan 22 '14 at 20:39
  • But also the private key?! I don't get this.. – Daniel W. Jan 22 '14 at 20:40
  • How did it get recovered? Or did my `rm` not delete it? – Daniel W. Jan 22 '14 at 20:40
  • That file wouldn't have been touched with a `rm *`. It takes a `rm -fr .*`. `rm` won't delete directories w/o the `-r` for recursive. – slm Jan 22 '14 at 20:41
  • I entered `rm psk * -Rf` but my `.ssh` directory didn't get deleted... lucky me! – Daniel W. Jan 22 '14 at 20:44
  • 1
    Those switches likely need to occur before the files, not after. I'm not sure what `rm` does when they're after like that. You dodged a big bullet. Back your critical files up!!! – slm Jan 22 '14 at 20:45