0

I have a web server set up using the www directory with a whole bunch of files that have not received their monthly backup. I've done a ton of work so I'd like to not restart.

I then set up an e-mail server that would create Maildir, etc. for e-mail on admin, etc.

Then tried to set up ftp for when I'm away and followed the accepted answer for

Basic Ubuntu FTP Server

Which worked fine but in the process all my files in www disappeared! I'm assuming its the combination with the mail server creating directories but what I really need to know is how to get the files back!

edit: My problem has been solved by me forgetting to close gedit. Thank god! On the other hand this is rather odd and supposedly not because of the adduser behavior. Most likely the default behavior of an e-mail server. But I've heard no mention of it being an issue. So it must be the combination. If it didn't delete the files they should have gone somewhere though and photorec should have been able to recover something that was only missing its link in the file table. Still a puzzle on multiple fronts.

1 Answer 1

0

It's hard to tell, but I think the /var/www directory was recreated (rm -rf then mkdir). It's hard to tell because I'm not sure exactly what adduser does when you add a user with a new home directory that already exists.

You wouldn't want to give a user a new home cluttered with files. I think adduser scrapped your work.

A program like photorec might be able to save you, but if you have to recreate everything it will be good practice and you'll learn not to use adduser on a directory you want to keep.

This is just a theory.

5
  • From man adduser: --home DIR Use DIR as the user's home directory, rather than the default specified by the configuration file. If the directory does not exist, it is created and skeleton files are copied. - if I understand it right, it does not say that it will delete a directory if it exists. So your theory is interesting, but very unlikely to be true.
    – Sergey
    Mar 15, 2013 at 7:06
  • Also, adduser is a perl script located in usr/sbin/adduser - you can study its contents and see that it indeed does not remove anything. Check out create_homedir function around line 650.
    – Sergey
    Mar 15, 2013 at 7:15
  • @Sergey do you know what you're talking about?
    – noel
    Mar 15, 2013 at 10:13
  • I'm talking about the fact that neither the documentation of the adduser command nor its source code have any indications that it deletes an existing directory. So, apart from "A program like photorec might be able to save you", the whole answer is... ehm... unsubstantiated :)
    – Sergey
    Mar 15, 2013 at 19:46
  • Already tried photorec as I had it installed for something like this. No luck obviously. Humorously noted that the "Redo its great practice!" comment is rather irksome applied to oneself. On the other hand its very true and last time this kind of thing happened I shrunk my code by a factor of 5 just knowing what I had to do ahead of time. On the upside I happened to have the file I most desperate wanted open in an editor! 15,000 lines of code saved!
    – user140416
    Mar 17, 2013 at 8:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .