You are not logged in.

#1 2018-05-02 19:11:59

diederick76
Member
Registered: 2010-02-14
Posts: 169

Can't execute scripts to which I have execute rights [SOLVED]

I have a directory ~/bin, in which I keep a couple of bash and sh scripts I use often. When I converted my disk from MBR to GPT I copied these files along with all files in my home to another disk, and afterwards I put them back using

rsync --progress -vrl --update -e "ssh -i ~/.ssh/mykey" /mnt/backup/archbox/home/me me@archbox:~/

Then all the files were back in my home, but when I try to execute the scripts, I get this error:

me@archbox ~/bin> ./flac2mp3
bash: ./flac2mp3: Access denied

Even though:

me@archbox ~/bin> ls -ln flac2mp3 
-rwxr-x--- 1 1000 1000 89 28 apr 12:01 flac2mp3*

which is my user id:

me@archbox ~/bin> id me
UID=1000(me) GID=1000(me) groups=1000(me),90(network),998(wheel)

When I start the scripts using

me@archbox ~/bin> bash flac2mp3

they run fine though.

Does anyone know what I'm missing here?

Thanks for any help!

Last edited by diederick76 (2018-05-02 20:27:18)

Offline

#2 2018-05-02 19:26:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Can't execute scripts to which I have execute rights [SOLVED]

Please post the output of the following:

stat ~/bin/flac2mp3
sed 1q ~/bin/flac2mp3
findmnt -T ~/bin/flac2mp3

Last edited by Trilby (2018-05-02 19:26:31)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2018-05-02 19:55:26

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,721

Re: Can't execute scripts to which I have execute rights [SOLVED]

Trilby,
What are you looking for in that sed command?  I get the other two.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#4 2018-05-02 20:10:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Can't execute scripts to which I have execute rights [SOLVED]

I'm looking for precisely what it does: it shows the first line and thus it should have the shebang.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2018-05-02 20:16:03

diederick76
Member
Registered: 2010-02-14
Posts: 169

Re: Can't execute scripts to which I have execute rights [SOLVED]

Trilby wrote:

Please post the output of the following:

stat ~/bin/flac2mp3
sed 1q ~/bin/flac2mp3
findmnt -T ~/bin/flac2mp3
me@archbox ~> stat ~/bin/flac2mp3 
  Bestand: /home/me/bin/flac2mp3
  Grootte: 89           Blokken: 8            IO-blok: 4096   normaal bestand
Apparaat: 821h/2081d   Inode: 179438851    Koppelingen: 1
Toegang: (0750/-rwxr-x---)   UID: ( 1000/me)   GID: ( 1000/me)
Toegang:   2018-05-02 21:06:12.330746017 +0200
Gewijzigd: 2018-04-28 12:01:34.570286375 +0200
Veranderd: 2018-04-30 13:30:08.213668979 +0200
Ontstaan:  -
me@archbox ~> sed 1q ~/bin/flac2mp3
#!/bin/bash
me@archbox ~> findmnt -T ~/bin/flac2mp3
TARGET SOURCE    FSTYPE OPTIONS
/home  /dev/sdc1 ext4   rw,nosuid,nodev,noexec,relatime,sync,data=ordered

It differs from the output of the last command.
The last line puzzles me, since:

me@archbox ~> grep -A1 "sdc1" /etc/fstab 
# /dev/sdc1
UUID=3acfd832-1761-45f8-9b34-24810195172e	/home		ext4		rw,auto,user,sync	0 1

It differs from the output of the last command.

Offline

#6 2018-05-02 20:19:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,721

Re: Can't execute scripts to which I have execute rights [SOLVED]

diederick76 wrote:

/home  /dev/sdc1 ext4   rw,nosuid,nodev,noexec,relatime,sync,data=ordered

Post your /etc/fstab.  You are configured to not permit execution of stuff on that volume

Last edited by ewaller (2018-05-02 20:20:14)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2018-05-02 20:20:30

diederick76
Member
Registered: 2010-02-14
Posts: 169

Re: Can't execute scripts to which I have execute rights [SOLVED]

ewaller wrote:
diederick76 wrote:

/home  /dev/sdc1 ext4   rw,nosuid,nodev,noexec,relatime,sync,data=ordered

Yes, I saw that, but since it is not specified in my /etc/fstab, why is it there and how do I remove it?

Offline

#8 2018-05-02 20:22:15

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Can't execute scripts to which I have execute rights [SOLVED]

man 8 mount wrote:

       user   Allow an ordinary user to mount the filesystem.  The name of the
              mounting user is written to the mtab file  (or  to  the  private
              libmount  file  in /run/mount on systems without a regular mtab)
              so that this same user can unmount the filesystem  again.   This
              option  implies  the  options  noexec, nosuid, and nodev (unless
              overridden  by  subsequent  options,  as  in  the  option   line
              user,exec,dev,suid).

Offline

#9 2018-05-02 20:22:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Can't execute scripts to which I have execute rights [SOLVED]

EDIT: too slow, see the above posts

Last edited by Trilby (2018-05-02 20:23:53)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2018-05-02 20:26:52

diederick76
Member
Registered: 2010-02-14
Posts: 169

Re: Can't execute scripts to which I have execute rights [SOLVED]

I have, and it worked. Excellent.

Thanks!

Offline

Board footer

Powered by FluxBB