Re: Is their Automatic command to send a JPG file using FTP
On Thu, 28 Jan 2010 13:39:38 -0800, Dixit, Viraj viraj.di...@cityofpaloalto.org wrote: Hi, The script that I have setup does not work if I run the .netrc file. I ran the commands in ftp -v mode and it did not like machine command, did not like passwd or pwd etc. Did you issue the command % ftp -v 0.0.0.0 (where 0.0.0.0 refers to the machine identifier in .netrc)? machine 0.0.0.0 login VJ password 123456 macdef init binary lcd /ftp cd /var/temp get newemp.db quit Looks valid to me, but you could do this more easily, at least for testing: % cd /var/temp % ftp VJ:123...@0.0.0.0/ftp/newemp.db This should get you the file into the correct directory. If I use this command in .netrc it connects to the server but it does not connect using my login name VJ, it points to some other name. ftp 0.0.0.0 ftp://ftp 0.0.0.0/ That's not the correct way to call the ftp program. .netrc simply doesn't work in FreeBSD. For sure it does, as described in the manpage. Is their someone who has a working script. Thanks!!! See my example above. At the moment, it doesn't seem that you send a file per FTP, but receive one. This can also be achieved through the .netrc file, but to make sure everything works ON BOTH SIDES of the connection, try the ftp command given above where the needed information is hardcoded. You can add the -v parameter, too. If you require more help, describe more exactly what you're intending to do. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Is their Automatic command to send a JPG file using FTP
On Wed, 27 Jan 2010 14:08:40 -0800, Dixit, Viraj viraj.di...@cityofpaloalto.org wrote: Hi, I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, In FreeBSD, there's documentation on that; read man ftp and see the -u option. I'm often (ab)using a Makefile to upload (send) files per FTP to a server, and I call this make install. You can put this into a shell script (sh) and then call it, e. g. #!/bin/sh FTPUSER=my_account_name_on_ftp_server FTPPASSWD=my_very_complicated_password SERVER=ftp.where_my_stuff_is.foo.bar UPLOAD=/path/to/files/to/upload cd ${UPLOAD} ftp -u ftp://${FTPUSER}:${ftppass...@${server} * Of course, you can utilize .netrc to contain FTP access data. Then, you just need to call pure ftp with server name, and you can replace * with any file name(s) you want. However, be aware that FTP doesn't encrypt passwords. You should take into mind that using FTP with an SSH wrapper, or even better - scp - is a more secure way to send files. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
RE: Is their Automatic command to send a JPG file using FTP
Thanks so much. One question, I created a .netrc file and put it in the root (/root) directory and this is what it looks like below. I have taken out the IP, user name password so no body can use them. Can you tell me if my syntax is correct and how do I activate this file and is this file in the right place on the server. Thanks, machine 172.16.0.38 login password macdef init binary lcd /ftp cd /var/temp get newemp.db quit VJ Viraj Dixit City of Palo Alto Information Technology 650-329-2118 -Original Message- From: Polytropon [mailto:free...@edvax.de] Sent: Thursday, January 28, 2010 12:03 AM To: Dixit, Viraj Cc: freebsd-questions@freebsd.org Subject: Re: Is their Automatic command to send a JPG file using FTP On Wed, 27 Jan 2010 14:08:40 -0800, Dixit, Viraj viraj.di...@cityofpaloalto.org wrote: Hi, I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, In FreeBSD, there's documentation on that; read man ftp and see the -u option. I'm often (ab)using a Makefile to upload (send) files per FTP to a server, and I call this make install. You can put this into a shell script (sh) and then call it, e. g. #!/bin/sh FTPUSER=my_account_name_on_ftp_server FTPPASSWD=my_very_complicated_password SERVER=ftp.where_my_stuff_is.foo.bar UPLOAD=/path/to/files/to/upload cd ${UPLOAD} ftp -u ftp://${FTPUSER}:${ftppass...@${server} * Of course, you can utilize .netrc to contain FTP access data. Then, you just need to call pure ftp with server name, and you can replace * with any file name(s) you want. However, be aware that FTP doesn't encrypt passwords. You should take into mind that using FTP with an SSH wrapper, or even better - scp - is a more secure way to send files. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Is their Automatic command to send a JPG file using FTP
On Thu, 28 Jan 2010 10:21:32 -0800, Dixit, Viraj viraj.di...@cityofpaloalto.org wrote: Thanks so much. One question, I created a .netrc file and put it in the root (/root) directory and this is what it looks like below. I have taken out the IP, user name password so no body can use them. Do you regularly work as root? :-) Can you tell me if my syntax is correct [...] Check man ftp, there's a whole section THE .netrc FILE. I know that the ability to rely on manpage information isn't very common in Linux land due to missing documentation quality. :-) [...] and how do I activate this file and is this file in the right place on the server. The syntax is ftp -N file. The default is ~/-netrc. machine 172.16.0.38 login password macdef init binary lcd /ftp cd /var/temp get newemp.db quit That looks okay to me. You can process it with ftp -v to check verbose output for any strange things, should they ever happen. In order to avoid interaction (especially when working with more than one file), you could add prompt to supress any manual input. By the way, FreeBSD's ftp program accepts stdin input, such as printf prompt\nmdelete *\nbye\n | \ ftp ftp://$(FTPUSER):$(FTPPASSWD)@$(SERVER)/ This is what I call make deinstall for web pages. :-) This means that you could do the same as with .netrc. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
RE: Is their Automatic command to send a JPG file using FTP
Hi, The script that I have setup does not work if I run the .netrc file. I ran the commands in ftp -v mode and it did not like machine command, did not like passwd or pwd etc. machine 0.0.0.0 login VJ password 123456 macdef init binary lcd /ftp cd /var/temp get newemp.db quit If I use this command in .netrc it connects to the server but it does not connect using my login name VJ, it points to some other name. ftp 0.0.0.0 ftp://ftp 0.0.0.0/ .netrc simply doesn't work in FreeBSD. Is their someone who has a working script. Thanks!!! -Original Message- From: Dan Nelson [mailto:dnel...@allantgroup.com] Sent: Wednesday, January 27, 2010 2:54 PM To: Dixit, Viraj Cc: freebsd-questions@freebsd.org Subject: Re: Is their Automatic command to send a JPG file using FTP In the last episode (Jan 27), Dixit, Viraj said: I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, FreeBSD's ftp command supports .netrc files. Is your current script not working? http://www.freebsd.org/cgi/man.cgi?query=ftp#THE_.netrc_FILE -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Is their Automatic command to send a JPG file using FTP
In the last episode (Jan 28), Dixit, Viraj said: The script that I have setup does not work if I run the .netrc file. I ran the commands in ftp -v mode and it did not like machine command, did not like passwd or pwd etc. The commands in .netrc are not the same ones that you send on the ftp commandline (except for the macdef block), so that's to be expected. I just tried your sample netrc file (with changes to match my system) and it worked just fine: (d...@dan.19) /tmp cat ~/.netrc machine 127.0.0.1 login dan password xx macdef init binary lcd /tmp cd / get COPYRIGHT quit (d...@dan.19) /tmp ftp 127.0.0.1 Connected to 127.0.0.1. 220 studio FTP server (Version 6.00LS) ready. 331 Password required for dan. 230 User dan logged in. Remote system type is UNIX. Using binary mode to transfer files. binary 200 Type set to I. lcd /tmp Local directory now: /tmp cd / 250 CWD command successful. get COPYRIGHT local: COPYRIGHT remote: COPYRIGHT 229 Entering Extended Passive Mode (|||62084|) 150 Opening BINARY mode data connection for 'COPYRIGHT' (6191 bytes). 100% |*| 6191 11.48 MB/s00:00 ETA 226 Transfer complete. 6191 bytes received in 00:00 (6.32 MB/s) quit 221 Goodbye. (d...@dan.19) /tmp ls -l /COPYRIGHT COPYRIGHT -r--r--r-- 1 root wheel 6191 Jan 13 11:14 /COPYRIGHT -rw-r--r-- 1 dan wheel 6191 Jan 13 11:14 COPYRIGHT If all you really want to do is download a single file from a remote server, you can give ftp a url-style commandline argument and it will log in and download the file automatically: http://www.freebsd.org/cgi/man.cgi?query=ftp#AUTO-FETCHING_FILES (d...@dan.19) /tmp ftp ftp://dan:xx...@127.0.0.1/%2fCOPYRIGHT Connected to 127.0.0.1. 220 studio FTP server (Version 6.00LS) ready. 331 Password required for dan. 230 User dan logged in. Remote system type is UNIX. Using binary mode to transfer files. 200 Type set to I. local: COPYRIGHT remote: /COPYRIGHT 229 Entering Extended Passive Mode (|||57935|) 150 Opening BINARY mode data connection for '/COPYRIGHT' (6191 bytes). 100% |*| 6191 4.42 MB/s00:00 ETA 226 Transfer complete. 6191 bytes received in 00:00 (2.52 MB/s) 221 Goodbye. -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Is their Automatic command to send a JPG file using FTP
Hi, I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, VJ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Is their Automatic command to send a JPG file using FTP
In the last episode (Jan 27), Dixit, Viraj said: I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, FreeBSD's ftp command supports .netrc files. Is your current script not working? http://www.freebsd.org/cgi/man.cgi?query=ftp#THE_.netrc_FILE -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Is their Automatic command to send a JPG file using FTP
On Wed, Jan 27, 2010 at 02:08:40PM -0800, Dixit, Viraj wrote: Hi, I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, VJ Sounds like you might want to learn about rsync. It is in the ports, probably //usr/ports/net/rsync It will work unattended if you sent up public/private key SSH. jerry ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Is their Automatic command to send a JPG file using FTP
On Wed, Jan 27, 2010 at 11:08 PM, Dixit, Viraj viraj.di...@cityofpaloalto.org wrote: Hi, I am looking to see if there a command or a script In BSD Os that will allow me to ftp to a server automatically and get a file from another server. User name and passwd will be already in the script so it will run ftp and download a file or a JPG from that server. Like in Linux OS there is a command using .netrc file and you can script that file and will automatically do what is in the file at time interval that you want. Thanks, VJ Yes, FreeBSD ftp supports .netrc files. I posted a guide to download a FreeBSD release with a .netrc file at http://www.daemonforums.org/showthread.php?t=4212 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org