What's new

Can Files be uploaded to RP-AX58

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Col8eral

Regular Contributor
I have an ASUS RP-AX58. I can SSH into it fine. Is it possible to upload and execute bash scripts on this nodes. I have tried scp and sftp with no luck.
 
If you have SSH access, then yes. Provided the scripts are not too big, you can just copy/paste them to the SSH terminal after issuing the following command (I'm assuming /tmp exists and is writable).

Code:
cat > /tmp/temp.sh

After pasting, hit Ctrl-C (to exit the cat command) and mark it executable.

Code:
chmod +x /tmp/temp.sh

scp should work also, but for small scripts, I often use the above since it's just simpler. But you may have a problem w/ larger scripts if they exceed the max size of the ssh buffer, causing unexpected results (e.g., truncation).
 
Thank you. I'll give that a go when I get home from work. I tried WINSCP to transfer the file which is 3KB, but I get the following error
"
---------------------------
Error
---------------------------
Copying files to remote side failed.
---------------------------
Cannot execute SCP to start transfer. Please make sure that SCP is installed on the server and path to it is included in PATH. You may also try SFTP instead of SCP.
Command failed with return code 127.
---------------------------
OK Help
---------------------------

"
 
I tried WINSCP to transfer the file which is 3KB, but I get the following error
The RP-AX58 is marketed as a Range Extender/ AiMesh Extender. Its possible there are certain modules are missing which may lead to the error you saw with WinSCP. Its also possible that unlike with the Asus routers, you might not be able to copy files to the unit or execute scripts.

What sort of script are you trying to run on the range extender?
 
I managed to get the script copied across but when executed it didnt work. I wanted to monitor the temps of the CPU and wifi and send an email alert and/or run an http post via curl. Both didnt work.

Interestingly I can retrieve the temps via SSH.

Is there a way to maybe run the script on my main router, and grab the variables via SSH as part of that script? Anyone have some ideas how I could maybe achieve that?
 
Is this a script of your making? Or provided to you by someone else (presumably proven to work)? Because just saying it didn't work doesn't tell us much. Big difference between "it doesn't run at all" vs. "it runs but produces script errors" vs. "it runs but doesn't produce the expected output".
 
Is there a way to maybe run the script on my main router, and grab the variables via SSH as part of that script?
It would help if you provided the router make/model and firmware it's running.

PS: When you copied the script to the extender did you check and or change the permissions of the script file so it could be executed? Maybe if you posted the script file people can review it to see if there are any issues.
 
It runs on my RT-AX88U. All the variables for the temps are the same as the mesh nodes.

I also trimmed it down just to run a simple curl and that didn't work either.

No errors are output.
 
It would help if you provided the router make/model and firmware it's running.

PS: When you copied the script to the extender did you check and or change the permissions of the script file so it could be executed? Maybe if you posted the script file people can review it to see if there are any issues.
The mesh node is an RP-AX58 the FW version is 3.0.0.4.388_24654

If I try and run this as the bash file it doesnt work, where as the same on my RT-AX88U works ok

I'm running the bash file from the tmp folder with permissions for the file set at 0755

#!/bin/sh
#Turn on device
curl --url "http://192.168.1.111:3480/data_requ...witchPower1&action=SetTarget&newTargetValue=1"
 
Can you elaborate on this? It looks like it is cat-ing (nothing) to a file on the router.

If you don't specify an input file to cat, then it expects input from standard input (i.e., the terminal). That's why I said you can copy/paste the script to the terminal window once you issue that command, then hit Ctrl-C to tell it that standard input has completed.
 
The following would work just as well.

Code:
cat << 'EOF' > /tmp/temp.sh
#!/bin/sh
<issue some bash commands>
EOF
chmod +x /tmp/temp.sh

In this case, the interpreter knows to treat everything after the cat command UP TO the EOF line as input to the file.

Or you could combine this w/ SSH itself so it doesn't have to be interactive.

Code:
ssh user@ip-address 'sh -s' << 'ENDSSH'
cat << 'EOF' > /tmp/temp.sh
#!/bin/sh
<issue some bash commands>
EOF
chmod +x /tmp/temp.sh
ENDSSH

Or let's say the script was a local file; you could pass it to ssh as standard input, which will similarly pass it as standard input to the cat command, thus providing something similar to scp.

Code:
cat ~/some-local-script.sh | ssh user@ip-address 'cat > /tmp/temp.sh && chmod +x /tmp/temp.sh'

This is what makes Linux so powerful; there are usually multiple ways to do things to get around limitations.

So you don't really need SCP in many cases to upload files. SCP just make it more convenient and direct.
 
Here's a shell script I have used when scp was not available:
Bash:
~ $ cat scp_to.sh
#!/bin/sh
tar cz $* | ssh <admin name>@192.168.1.1 'tar xvz'
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top