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.
Could you give us some more information about what you're trying to accomplish? The code you posted is PHP code to connect to another server and copy / receive files using scp (over SSH connection). The host shell.example.com is just that, an example.
Be careful to use code you don't understand. I imagine you've found that code here. You're aware you need a webserver like Apache for example, with PHP enabled and installed and besides that you'll need the functions you're calling in your code? If you have everything, including access to the remote server, you can try it out. Substitute the values in the script for the ones you use to connect and try it out. Watch log files for any errors.
If you don't understand what I said about needing a webserver, PHP, the functions, ... are you confident enough to get this set up? I think you'd better read some books to acquire the basic knowledge you need for this. Or what part of my post didn't you understand? The more detail you provide the better someone can help you. Tell me what part you don't understand and I'll try to explain.
Be careful to use code you don't understand. I imagine you've found that code here. You're aware you need a webserver like Apache for example, with PHP enabled and installed and besides that you'll need the functions you're calling in your code? If you have everything, including access to the remote server, you can try it out. Substitute the values in the script for the ones you use to connect and try it out. Watch log files for any errors.
Kind regards,
Eric
you said function to call code. function like what you mean? function to called .sh file or what? and about access to remote server?
The words in bold are functions that are defined somewhere else in another PHP script or are complete PHP scripts you're calling. So if you only have the code you originally posted without those parts your script will do nothing (only give an error).
With access to remote server I mean that if you want to copy a file from one computer to another you need access to that remote machine in the form of a user/password combination (which you must provide in the script you posted where it says username and password). Without those you will not be allowed to copy files to the other machine. I hope that makes it a bit clearer.
The words in bold are functions that are defined somewhere else in another PHP script or are complete PHP scripts you're calling. So if you only have the code you originally posted without those parts your script will do nothing (only give an error).
With access to remote server I mean that if you want to copy a file from one computer to another you need access to that remote machine in the form of a user/password combination (which you must provide in the script you posted where it says username and password). Without those you will not be allowed to copy files to the other machine. I hope that makes it a bit clearer.
Kind regards,
Eric
oh now i understand.. that why i already created a form for the user to enter ip and password and also some php code for submit the input.
OK, if you're storing your password in $ip2 then I just misunderstood. Assigning those strange names for a variable that will hold a password is confusing to all except to you. Have you tested your script and if so what are the results?
OK, if you're storing your password in $ip2 then I just misunderstood. Assigning those strange names for a variable that will hold a password is confusing to all except to you. Have you tested your script and if so what are the results?
Kind regards,
Eric
haha.. sorry.
i tried run it with web browser.. nothing copied.. i already check inside home
You do have the function scripts right? And I get the impression you're using this script to copy locally right? Is your SSH server running and set up correctly?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.