スコア
117
Advertisement
回答 (10)
解決策が見つかりました
スコア
188
2011-08-15 04:39:47 +0000
これは一つの方法です。
$ ftp -n <<EOF
open ftp.example.com
user user secret
put my-local-file.txt
EOF
別の方法としては、ftp コマンドを実行するユーザのホームディレクトリに ~/.netrc ファイルを作成 (または編集) して、適切な perms (chmod 0600 ~/.netrc) を与え、以下を追加します。 netrc ファイルを作成(または編集)し、ftp コマンドを実行するユーザのホームディレクトリに適切な perms (&007) を与え、次のように追加します:
# ~/.netrc
machine ftp.example.com
login user
password secret
その後、次のようにログイン情報を省略します:
$ echo put my-local-file.txt | ftp ftp.example.com
また、ここでは、curl を使用して同じことを行う方法を説明します:
$ curl -T my-local-file.txt ftp://ftp.example.com --user user:secret
Advertisement
Advertisement
Advertisement
スコア
4
2013-01-10 09:06:56 +0000
ここに例があります:
lftp -e 'cd folder1/folder2; put /home/path/yourfile.tar; bye' -u user,password ftp.theserver.com
についてはこちらを参照してください。
divinedragon
http://superuser.stackexchange.com/users/37970
スコア
2
2015-04-29 07:48:35 +0000
コマンドラインでファイルを遠隔地にアップロードする
#!/bin/bash
#$1 is the file name
#usage:this_script <filename>
HOST='yourhost'
USER="youruser"
PASSWD="pass"
FILE="abc.php"
REMOTEPATH='/html'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd $REMOTEPATH
put $FILE
quit
END_SCRIPT
exit 0
Advertisement
スコア
1
2015-02-16 17:47:05 +0000
私はBusyBoxのftpputを使っています:
# /bin/busybox ftpput
BusyBox v1.20.2 (Debian 1:1.20.0-7) multi-call binary.
Usage: ftpput [OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE
Upload a file to a FTP server
-v,--verbose Verbose
-u,--username USER Username
-p,--password PASS Password
-P,--port NUM Port
注意: busybox ftpgetもよく効きます。
Advertisement
スコア
0
2017-07-31 02:59:52 +0000
I improved Marty answer like below (include binary):
[ftp_example_1.sh.sh]
$ ftp_example_sh.sh dump_file
ftp -n <<EOF
open 192.168.0.10
user anonymous aaa
binary
put $1
EOF
[ftp_example_2.sh]
$ftp_example_2.sh 192.168.0.10 dump_file
ftp -n <<EOF
open $1
user anonymous aaa
binary
put $2
EOF
&001
sailfish009
http://superuser.stackexchange.com/users/37970
スコア
-1
2017-08-25 18:06:21 +0000
FtpPut(){
echo `echo -e "open host\nuser user pass\nbinary\nput $1\nquit"|ftp -nv`
}
FtpPut asd.txt
FtpPut asd.mp4
FtpPut asd.php
...
Yöncü Bilişim Çözümleri
http://superuser.stackexchange.com/users/37970