Hi Mike,
You wrote with a question about editing a file on a server:
MB:
hey all;
is there a way with terminal for me to get a file off a remote
CentOS server? I want to edit a file:
/etc/asterisk/sip.conf
but do not have an ftp account set up on that server, if i did i
would just
cp /etc/asterisk/sip.conf /home/ftp/sip.conf
but right now do not have an ftp account (looking up how to do
that on google right now). I just need to add 2 lines to this
file to get my asterisk system working again;( grr, any ideas?
mike
ps is there a way i could edit it on the server?
and followed up with your solution:
MB:
what i did was ssh'ed into the server, ftp'ed the file to the
other serveri h ave access to, thanks
Now, thanks to twitter, you can see everything i'm doing or
thinking, visit
http://www.twitter.com/creepyblindy
and follow me if you have an account;)
If you had SSH access to the server account, you probably didn't need
to FTP the file to another server to access it, and could have used
SFTP to transfer the file instead. SFTP is part of the family of
commands that works through the SSH (Secure Shell) connection, and is
used to transfer files. I've referred to this as "Secure FTP" as a
mnemonic to think of this, but it doesn't have anything to do with
the FTP protocol, and specifically can run on accounts and machines
where you haven't set up an FTP server.
So from the terminal, change your ssh login to an sftp login:
For example:
sftp [EMAIL PROTECTED] [sftp <username> AT <server_name>]
or
sftp [EMAIL PROTECTED] [sftp <username> AT <server IP address>]
where the terms in square brackets are shown for those people reading
this post on a web page -- omit the square brackets, substitute the @
sign for "AT", and remove spaces between the @ symbol and the
<username> and <server_name>
You'll be prompted for your account password.
Once you've logged in, change to the directory you want:
cd /etc/asterisk/
You can also optionally type commands to list the files on this
account, or to list files that match given wild cards. For example:
ls *.conf
will display a list of all files in that directory with a .conf
extension
Then issue a command to get the file or files you want. (Again, wild
cards work here). For example:
get sip.conf
Once the file is on your Mac, you can use TextEdit or any application
you want to edit it. If it takes a while (10 or 15 minutes?) your
SFTP session may time out, so that even if the prompt is there, your
connection won't be active. Just type "quit" or "exit" omitting the
quotation marks, and start the session again with the "sftp" command
followed by the "cd" command.
Then, upload your edited file with:
put sip.conf
and exit.
The above assumes that you have read and write access to the account
with the file. Of course, you'd also need that access for your
solution of first copying the files to another FTP server to access
them and then replacing them.
HTH
Cheers,
Esther