I am using WSL Ubuntu-Bionic on my laptop and copied a file to a beaglebone (Debian-Stretch). Somehow it is shown by ls -l when I ssh onto the beagle, but if I try to run it, I get an error:
scp test debian#134.147.152.133:~/crosstest
ssh debian#134.147.152.133
ls -l
-rwxr-xr-x 1 debian debian 8936 Jan 8 09:50 crosstest
./crosstest
-bash: ./crosstest: No such file or directory
After searching around a bit, I found a solution:
As Romeo wrote, this had to have something todo with the file itself. I recompiled the file using arm-linux-gnueabihf-g++ instead of arm-linux-gnueabi-g++.
I found this after reading this SO post
Related
Today, my working bash scripts stopped working on my Debian 11 server.
$ ./CCrec.sh
-bash: ./CCrec.sh: Permission denied
Fails even if using sudo.
Yes, the permissions are set correctly. (They've been working for years.)
$ ls -l CCrec.sh
-rwxr--r-- 1 user1 user1 858 Jan 23 20:30 CCrec.sh
Another clue: autotab it doesn't recognize the script is present with beginning with "./". This makes me think the's a change in my bashrc, but I'm not noticing a change.
script will run when specifying bash:
$ bash CCrec.sh
This is working
Any solutions?
I'm copying my kernel config file from an existing system to the kernel tree, and I entered this command:
/boot/config$(uname -r)
Yet I got:
bash: /boot/config-5.15.0-46-generic: Permission denied
Does anyone know why its saying permission denied and how to fix? I am using Ubuntu in VirtualBox.
As #Tsyvarev mentioned in comments it is possible that you're trying to execute file, that have no exec permissions:
$ ls -l /boot
...
-rw-r--r-- 1 root root 217414 Aug 20 2021 config-5.4.0-rc1+
...
Try to run: cat /boot/config-$(uname -r) to read the config file for currently running kernel.
The shebang line in my bin/www file is:
pi:~/ferc$ head -n 1 bin/www
#!/usr/bin/env node
However, executing it:
pi:~/ferc$ bin/www
bin/www: line 1: #!/usr/bin/env: No such file or directory
The env file does exist:
pi:~/ferc$ ls -lL /usr/bin/env
-rwxr-xr-x 1 root root 31408 Feb 18 2016 /usr/bin/env
The node file also exists:
pi:~/ferc$ ls -al /usr/bin/node
lrwxrwxrwx 1 root root 15 Jul 7 18:29 /usr/bin/node -> /usr/bin/nodejs
And node runs fine:
pi:~/ferc$ node -v
v4.2.6
What does the error message really mean? Which file is it complaining about?
The cause was a corrupted file, probably due to a mixture of LF and CF/LF line endings in the file.
What happened were:
I copied the file from a Windows PC to the AWS ec2 Ubuntu instance.
First time I ran the www file, that same error message appeared. The cause at this point was probably the node executable did not exist. I hadn't created the symbolic link yet.
While trying to troubleshoot, I edited and saved the www file using nano. I think at this point the file got corrupted.
Later, I added the symbolic link for /usr/bin/node. However, the same error persisted, but probably due to the corrupted line endings.
I dos2unix the www file, and the error went away.
You can use node directly like:
#!/usr/bin/node
See pros and cons: https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my
I need to send a copy from server1 to server2 using ssh2. Both are using ubuntu, and I'm trying sending it with the scp command:
scp test.txt userName#server2_direction:/folder_destination
But I'm getting an error:
test.txt: No such file or directory
I tried putting the complete url: /users/asd/my_user/folder/test.txt, but it doesn't work either.
Any hints?
You are in the wrong directory on the source computer. Check if there is test.txt in the current directory.
$ ls -l test.txt
I'm writing a script for using SSH "profiles", ~/scripts/ssh-profiled.sh
PROFILE=`cat ~/script/ssh-profiles/$1`
echo [ssh $PROFILE]
ssh $PROFILE
~/scripts/ssh-profiles/tummi
-i ~/Dropbox/security/key-nopass/key-nopass.pvt bart#example.com
When I run the script, it fails:
bart#bart-laptop:~$ script/ssh-profiled.sh tummi
[ssh -i ~/Dropbox/security/key-nopass/key-nopass.pvt bart#example.com]
Warning: Identity file ~/Dropbox/security/key-nopass/key-nopass.pvt not accessible: No such file or directory.
bart#example.com's password:
But this works:
bart#bart-laptop:~$ ssh -i ~/Dropbox/security/key-nopass/key-nopass.pvt bart#example.com
Linux tummi 2.6.32-24-server #39-Ubuntu SMP Wed Jul 28 06:21:40 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04.1 LTS
Welcome to the Ubuntu Server!
Is there an error/gotcha in my script?
Change 1st line to
eval PROFILE=`cat ~/script/ssh-profiles/$1`
For explanation see here
The ~ in your file needs to be the full home directory path, it's not getting expanded.
My guess is the "~/" is not being interpreted as expected when passed in that way. Try using an explicit full path.
What are the permissions on the .pvt file? If only you have read access, and no one can execute it, then your script might not be able to even see the file. That could be why you are getting the "...not accessible: No such file or directory." message.