Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hello, I have been trying to copy files inside my folder /root/ to the /var/www folder and have used the following to copy them: Code: #! /bin/sh for i in ...
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5

    Copying files from root directory to www

    Hello,

    I have been trying to copy files inside my folder /root/ to the /var/www folder and have used the following to copy them:
    Code:
    #! /bin/sh
    
    for i in `ls votes.log`
    do
    mv $i /var/www/$i$.log
    done
    I have got this script and seems to work locally in the folder, it works if I use /root/ as path but I cannot get it to the /var/www path because it will return:
    Code:
    mv: cannot move `votes.log' to `var/www/vote/votes.log': No such file or directory
    How am I able to solve this? (Just a quick note: I am a total beginner to Linux so I will not be able to do most things myself)

    I hope somebody can help me with this,
    Aron

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    616
    Check your script, your variables are wrong:

    use

    Code:
    for i in `ls votes.log`
    do
    mv $i /var/www/
    done
    but i don't know how exactly you are wanting your structure to look
    linux user # 503963

  3. #3
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5
    Thank you for your reaction.

    I think I have found out what the problem was but currently have made a much bigger mistake. I have found out that my "root" user was assigned to the /root/ folder and not the / folder, so it could not open the /var/www/ folder. So I have attempted creating a new account and then assign it to the / folder. I did the following thing:
    Code:
    adduser server
    sudo chown -R server:server /
    I found this on the ubuntu help site.
    But now after I disconnected and attempt to connect through putty, it returns: "Server Unexpectedly closed network connection."

    How will I be able to fix this and the other problem with the folders?

    I hope somebody can help me further,
    Aron

  4. #4
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    I could be wrong, but I think that's very bad. Is this a server you have direct access to? Also could you post the URL where you found this please? (You may need to put a couple of spaces in there to get it past the spam filter)
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  5. #5
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5
    I just found out my FTP is not working either, and yes, it is a server hosted at Kimsufi which I have direct access to.

    The bad thing is that I currently have an active server running which I can not backup since I cannot connect through SSH or FTP, and rebooting will shut it down.

    The link is: help. ubuntu.com /11.04/serverguide/C/user-management .html

  6. #6
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    It looks like you have created a new user called server and then changed ALL files to be owned by that user. The only way I know how to fix this kind of situation is to boot the server from a CD and while in front of the machine use a chrooted environment to sort out the permissions.
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  7. #7
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5
    What do you think the best solution is since it is impossible for me to go to the datacenter it is located in, although I can reinstall it through the website. But I cannot have all the files stored on the server going to wash away.

  8. #8
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    Quote Originally Posted by Aronnn View Post
    What do you think the best solution is since it is impossible for me to go to the datacenter it is located in, although I can reinstall it through the website. But I cannot have all the files stored on the server going to wash away.
    I'm afraid I don't know how you can fix this without being in front of the machine with a monitor, keyboard and live CD.
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  9. #9
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5
    But do you think the host will be able to fix the permissions without having to reinstall it? If so, I will hope they can help me with this and will figure it out.

  10. #10
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    I would assume so, but they would have to confirm that
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...