Putty

Discussion in 'Programming' started by yuknodoit, Jan 3, 2008.

  1. #1
    How do I copy accounts on a Linux server via putty?

    I've tried cp -rf /home/ajaxarca ~/home/greatarc but I get this error:

    cp: cannot create directory `/root/home/greatarc': No such file or directory

    Thanks.
     
    yuknodoit, Jan 3, 2008 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Why are you using the $HOME character (~) ?
     
    ajsa52, Jan 3, 2008 IP
  3. yuknodoit

    yuknodoit Well-Known Member

    Messages:
    469
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #3
    This is the first time that I have used putty. That is simply what I read!

    Tried it without and it appears to be working, however it is asking me if I want to continue on every single file. How can I make it do them all at once?

    Thanks!
     
    yuknodoit, Jan 3, 2008 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Try with this command:
    
    cp -rf --reply=yes /home/ajaxarca /home/greatarc
    
    Code (markup):
    If that command does not work, look on man page: "man cp"

    EDIT: If you want to preserve file attibutes like timestamps or ownerships, you should use the '-p' command flag:
    
    cp -rfp --reply=yes /home/ajaxarca /home/greatarc
    
    Code (markup):
     
    ajsa52, Jan 3, 2008 IP
  5. yuknodoit

    yuknodoit Well-Known Member

    Messages:
    469
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Does not work, getting this message:

    cp: the --reply option is deprecated; use -i or -f instead

    Looked in the man page but could not find anything.

    What it is actually saying is if I want to overwrite to each file. Is there some overwrite all command?
     
    yuknodoit, Jan 3, 2008 IP
  6. yuknodoit

    yuknodoit Well-Known Member

    Messages:
    469
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #6
    Went through all files holding down enter on commands all like this:

    cp: overwrite `/home/greatarc/ajaxarca/public_html/thumb/20946.png'?

    Took a few minutes but did nothing. The files did not copy. :S
     
    yuknodoit, Jan 3, 2008 IP
  7. yuknodoit

    yuknodoit Well-Known Member

    Messages:
    469
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #7
    Instead of copying the account it created a directory named ajaxarca.

    When clicking on the directory I get this message:

    Could not open PWD: Permission denied at cpanel.pl line 563
    Carp::croak('Could not open PWD: Permission denied') called at /usr/local/cpanel/Cpanel/Fileman.pm line 651
    Cpanel::Fileman::listfiles('/home/greatarc/ajaxarca') called at cpanel.pl line 563
    main::__ANON__('/home/greatarc/ajaxarca') called at cpanel.pl line 1555
    main::exectag('<cpanel Fileman="listfiles($FORM{\'dir\'})">') called at cpanel.pl line 4455
    main::dotag(undef) called at cpanel.pl line 4344
    main::cpanel_parseblock('SCALAR(0x9120778)') called at cpanel.pl line 4298
    main::cpanel_parse('GLOB(0x9a910a8)') called at cpanel.pl line 1119


    Does anyone have any idea what I am doing wrong?
     
    yuknodoit, Jan 3, 2008 IP
  8. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #8
    To copy the directory tree without prompts, you can erase the destiantion directory first:
    
    rm -rf /home/greatarc
    cp -rfp /home/ajaxarca /home/greatarc
    
    Code (markup):
    And about "Permission denied" error, probably you need to add an entry on the /etc/passwd file.
     
    ajsa52, Jan 3, 2008 IP
  9. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #9
    
    cp -rf home/ajaxarca home/greatarc
    
    Code (markup):
    Peace,
     
    Barti1987, Jan 3, 2008 IP
  10. yuknodoit

    yuknodoit Well-Known Member

    Messages:
    469
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #10
    I finally got it to work with:

    cp -a /home/ajaxarca/* /home/greatarc/

    Thanks.
     
    yuknodoit, Jan 4, 2008 IP
  11. thapame

    thapame Well-Known Member

    Messages:
    739
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    180
    #11
    nice to hear it's working finally
     
    thapame, Jan 6, 2008 IP