Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The ssh port of my remote machine is changed from 22 to another number, I have problem to change it in the psftp, now I can not locate to the host machine, I can not open the ssh_config file to change the ssh port number. Now I have problem to transfer any file from my local machine to the host machine.
Any suggestion please how to connect to the host through the sftp?
Did you restart ssh to reload the new settings?
Did you change the firewall if running on the remote machine to accept incoming connections on the new port?
Have you tried:
psftp -P New_Port_number remote_machine_name
or
psftp -P New_Port_number IP.address.remote.machine
Yes, I have tried both psftp -P New_Port_number remote_machine_name and psftp -P New_Port_number IP.address.remote.machine, but it doesn´t recognise any command as psftp, cat or vim.
I can't restart the ssh while no command is working on it.
I don't know how to change the firewall on my remote machine.
I don't know which version is on the remote machine and I don't have physical access to the remote machine.
Yes, I am trying to run cat and vim on a windows not the remote machine because I need to change the port number on my local computer but most of the commands are not working on psftp here not even the listing command "lls" , any suggestion?
I don't understand. Sounds like you started psftp but not logged into the remote machine. Can you log on to the remote machine via PuTTY? To run commands on the remote machine like cat and vim you need to use PuTTY not psftp.
If you can not log in to the remote machine using ssh via PuTTY due to the changes in port number and you have no other means to access the computer then someone with physical access must change your ssh settings back.
I might suggest using a windows sftp client to transfer files like WinSCP or Filezilla.
I can log in to the remote machine via Putty and run all the commands on the remote machine, my problem is I have many files on my local machine that I need to transfer to the remote machine, now I can not transfer them after the ssh port was changed.
as I read about it I can change the port number in psftp in sshd-config file there though I am not sure I have this file or not.
I started to use putty 4 weeks ago and I found it fine until this problem appeared.
sshd_config is for configuring the server not the client. The same port number used for PuTTY is the same that you use for psftp. What happens when you try running psftp using the above using the command posted above. You can also start psftp and select the port with the open command.
Again it might be easier using a GUI client instead of a psftp
Changing the port number in Putty is easy just make it in the Putty window, but for psftp I think in the first time when you log in to the sever it asks you about the secure server and on when you chose yes it saves it in sshd-config and will stay there until you change it manually. any how now I downloaded winSCP it looks very easy and quick I didn't know about that until u said it, I think it is the best way to transfer the files in between local and remote machines. psftp made me tired I will let it as its, I don't need it any more. Thank you for your help michaelk.
Just for your information you can start psftp using the -P option as stated in my earlier post or if you just click psftp from the file browser you get the sftp command prompt and can log in using the port number like:
sftp> open server 1234
You will then be asked the username and password. Typing in a ? (help) will display a list of ftp commands.
I have tried it several times but it didn't work, it says unknown command "sftp" as for the other commands it says, when I try to open it with open command as before "open host name" or "open -p new port number host name" the psftp window was disappearing this time I mean after the port number was changed. I have checked help for the commands they are not many and sftp is not listed there.
Thank you for offering more help.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.