Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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 '13 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 '13 at 7:15
    
@Sergey do you know what you're talking about? –  shakabra Mar 15 '13 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 '13 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 '13 at 8:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.