명령을 사용하여 ftp를 사용하여 컴퓨터 A에서 컴퓨터 B로 파일을 복사하는 방법

명령을 사용하여 ftp를 사용하여 컴퓨터 A에서 컴퓨터 B로 파일을 복사하는 방법

명령을 사용하여 원본 컴퓨터 A에서 대상 컴퓨터 B로 파일을 복사하고 ftp를 사용하고 싶습니다.

나는 이것을 시도했다

scp /home/varun/Desktop/Test.java username_for_target_machine@ip_address_of_target_machine:/home/Desktop/

The authenticity of host 'ip_address_of_target_machine (ip_address_of_target_machine)' can't be established.
RSA key fingerprint is 4a:49:cc:9d:ab:f6:ec:4f:b2:0b:63:ef:8f:b8:76:76.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ip_address_of_target_machine' (RSA) to the list of known hosts.
qaserve@ip_address_of_target_machine's password: 

대상 컴퓨터에 비밀번호를 제공할 때

Permission denied, please try again.

여러 번 시도했지만 동일한 결과가 나타납니다.

  1. 내가 어디서 실수를 하고 있는 걸까?
  2. 명령에서 비밀번호를 묻지 않도록 사용자 이름과 비밀번호를 어떻게 제공합니까?

업데이트:1

SSH를 사용해 보았습니다. 다음은 내가 따라온 단계입니다.

1. 로컬 호스트와 원격 호스트가 openSSH를 실행 중인지 확인

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

2. ssh-keygen을 사용하여 로컬 호스트에서 키 쌍을 생성합니다.

Generating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
31:3a:5d:dc:bc:81:81:71:be:31:2b:11:b8:e8:39:a0 jsmith@local-host

3. 원격 호스트에 공개 키를 설치합니다.

[remote-host]$ vi ~/.ssh/authorized_keys 
ssh-rsa ABIwAAAQEAzRPh9rWfjZ1+7Q369zsBEa7wS1RxzWR jsmith@local-host

4. 원격 호스트의 .ssh 디렉터리에 적절한 권한을 부여합니다.

[remote-host]$ chmod 755 ~/.ssh
[remote-host]$ chmod 644 ~/.ssh/authorized_keys

5. SSH 키 인증을 사용하여 로컬 호스트에서 원격 호스트로 로그인하여 제대로 작동하는지 확인합니다.

[local-host]$ ssh -l jsmith remote-host

위 명령을 실행하면 다음과 같은 결과가 나타납니다.

ssh: connect to host remote-host port 22: Connection timed out

내가 입력할 때

ssh -l ipaddress_of_remote-host remote-host

비밀번호를 묻는 메시지입니다. 비밀번호를 제공하면 원격 호스트에 연결됩니다.

원격 호스트에 공개키를 등록했는데 왜 다시 비밀번호를 요구하나요?

업데이트 2: 혼란스러워서 죄송합니다.

  1. 모든 프로토콜을 사용하여 소스에서 대상으로 파일을 복사하고 싶습니다. 권한 변경

  2. [원격 호스트]$ chmod 700 ~/.ssh [원격 호스트]$ chmod 600 ~/.ssh/authorized_key

답변1

  1. 원격 서버의 /home/Desktop에 대한 권한이 없을 수 있습니다. /home/username_for_target_machine/Desktop을 시도해 보십시오.
  2. 아니요, 그렇게 생각하지 않습니다. 하지만 "ssh 공개 키 인증"을 위해 Google을 사용할 수 있습니다.

답변2

여기서 여러 가지를 혼동하고 있습니다. 우선 이 중 어느 것도 ftp와 관련이 없습니다. scp가 아닌 을(를) 사용하고 있습니다 ftp. 왜 ftp를 언급하는 걸까요? 그런 다음 IP를 사용자 이름으로 사용하여 호스트에 연결을 시도하는 것 같습니다( -l연결할 사용자 이름 제공). 또한 파일에 대한 권한이 잘못되었습니다 authorized_keys. 600700이 아닌 644및 이 필요합니다 755. 마지막으로, 이는 어쨌든 키를 복사하는 좋은 방법이 아닙니다 ssh-copy-id.

그럼 처음부터 시도해 보겠습니다. 1단계와 2단계는 괜찮습니다. 이제 다음을 수행하십시오.

  1. 원격 authorized_keys파일에 추가한 항목을 제거합니다.

  2. 원격 호스트에 대한 권한을 수정합니다.

    [remote-host]$ chmod 700 ~/.ssh/
    [remote-host]$ chmod 600 ~/.ssh/authorised_keys
    
  3. 로컬 호스트에서 키를 원격 호스트에 복사합니다.

    [local-host]$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@ipaddress_of_remote-host
    
  4. 다시 로그인해 보세요

    [local-host]$ ssh jsmith@ipaddress_of_remote-host
    
  5. 호스트가 이름을 네트워크로 올바르게 내보내지 않는 것 같습니다. 빠른 수정을 위해 다음을 실행하세요.

    [local-host]$ echo "ipaddress_of_remote-host 호스트 이름" | sudo tee -a /etc/hosts

    그러면 호스트 이름이 해당 IP의 별칭으로 저장됩니다. 이제 에 연결할 수 있습니다 ssh user@hostname.

답변3

비밀번호를 요구하므로 FTP를 구성하지 않은 것 같습니다. 다음 링크를 확인하세요.

1)http://www.mpipks-dresden.mpg.de/~mueller/docs/suse10.2/html/opensuse-manual_en/manual/sec.filetrans.copy.html

FTP 서버를 구성하려면 다음과 같이 진행하십시오.

**Prepare the FTP server:**

    Install the vsftp package.

    Open a shell, login as root and save a backup copy of /etc/vsftpd.conf:

    cp /etc/vsftpd.conf /etc/vsftpd.conf.bak

    Create an access point for anonymous FTP

    mkdir ~ftp/incoming
    chown -R ftp:ftp ~ftp/incoming

Replace the configuration files depending on the scenario you prefer (refer to the manual page of vsftpd.conf for advanced configuration options):

Allowing Anonymous Read and Write Access

    #
    listen=YES

    # Enable anonymous access to FTP server
    anonymous_enable=YES

    #
    local_enable=YES
    # Enable write access
    write_enable=YES
    anon_upload_enable=YES
    anon_mkdir_write_enable=YES
    dirmessage_enable=YES
    # Write log file 
    xferlog_enable=YES
    connect_from_port_20=YES
    chown_uploads=YES
    chown_username=ftp
    ftpd_banner=Welcome to FTP service.
    anon_root=/srv/ftp

Grant Restricted Permissions to FTP Users (Home Only)

    chroot_local_users=YES

Restart the FTP server:

rcvsftp start

클라이언트에서 URL을 입력하세요.ftp://호스트브라우저나 FTP 클라이언트에서. HOST를 서버의 호스트 이름이나 IP 주소로 바꾸세요. FTP 서버의 콘텐츠를 검색하는 데 적합한 그래픽 사용자 인터페이스가 많이 있습니다. 목록을 보려면 YaST 패키지 관리자의 검색 프롬프트에 FTP를 입력하면 됩니다.

관련 정보