FOP
FOP

Reputation: 1022

bash sh script with user permissions 755, cannot be run

Why can't run it?
If I run it in the following way, it works:

[usuario@MyPC ~]$ sh ./x11vnc.sh
PORT=5900

First, the permissions, so that you can see that it is in 755.

ls -l
-rw-rw-rw- 1 usuario users  4485 dic  2 11:35  x11vnc.log
-rwxr-xr-x 1 usuario users   117 nov  7 14:06  x11vnc.sh

Second,the script file

cat x11vnc.sh
#!/bin/bash
x11vnc -nap -wait 30 -noxdamage -passwd somepass -display :0 -forever -o ~/x11vnc.log -bg -rfbport 5900

Third, I must clarify the structure of the disks

lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda           8:0    0   3,6T  0 disk  
├─md126       9:126  0   3,6T  0 raid1 
│ ├─md126p1 259:3    0   3,6T  0 part  /home/usuario
│ └─md126p2 259:4    0     8G  0 part  [SWAP]
└─md127       9:127  0     0B  0 md    
sdb           8:16   0   3,6T  0 disk  
├─md126       9:126  0   3,6T  0 raid1 
│ ├─md126p1 259:3    0   3,6T  0 part  /home/usuario
│ └─md126p2 259:4    0     8G  0 part  [SWAP]
└─md127       9:127  0     0B  0 md    
nvme0n1     259:0    0 232,9G  0 disk  
├─nvme0n1p1 259:1    0 232,6G  0 part  /
└─nvme0n1p2 259:2    0   256M  0 part  /boot

I am the user usuario. I can edit and modify the x11vnc.sh file as I wish, but I can't run it, and I need to run it to include in the auto-start session of the plasma.

[usuario@MyPC ~]$ ~/x11vnc.sh
-bash: /home/usuario/x11vnc.sh: permission denied

Upvotes: 4

Views: 597

Answers (1)

FOP
FOP

Reputation: 1022

Thank you all, specially to @CharlesDuffy

I change the fstab line from

UUID=16b711b6-789f-4c27-9d6c-d0f744407f00 /home/usuario ext4 auto,exec,rw,user,relatime 0 2

to

UUID=16b711b6-789f-4c27-9d6c-d0f744407f00 /home/usuario ext4 auto,rw,user,exec,relatime 0 2

The position of exec is important, since user also applies noexec. By putting exec after user, you ensure that exec is set. The most important options should be listed last

Upvotes: 3

Related Questions