<div dir="ltr"><div><div><div><div><div>I was working on a bash script to automate some LXD/LXC container setups.<br><br></div>I successfully created the container cn1<br><br></div>I successfully added a new User to cn1<br><br></div>I successfully PUSHed several script files to the Home directory of the new User in CN1<br><br></div>However, when I try to chmod +x those scripts using:<br><br><b>      lxc exec cn1 -- chmod +x /home/$USER/*.sh<br><br></b>it seems to be trying to do it on the Host instead & fails!  <br><br>I have searched but can't find a reason why or if I am using the exec command wrong.<br></div><div><br></div>A snippit of my Host script is below:<br><div><i><br>   lxc remote add images <a href="http://images.linuxcontainers.org">images.linuxcontainers.org</a>  # this works<br><br></i></div><div><i>   # launch as a Priviliged container <br></i></div><div><i>   lxc launch images:ubuntu/wily/amd64 cn1 -c security.privileged=true  # this works<br><br>   # create the new User in BOTH cn1 container<br>   lxc exec cn1 - - adduser $USER     # this works<br><br>   #----------------------------------------------------------------------------------------------------------------<br>   # Next pushing the appropriate script to its now running container.  <br>   #-----------------------------------------------------------------------------------------------------------------<br><br>   lxc file push ./mk-cn1-environment.sh cn1/home/$USER/     # this works<br><br>   # make sure bash scripts we pushed are executable --  THIS FAILS<br><b><br>   lxc exec cn1 - - chmod +x /home/$USER/*.sh</b></i><br><br><br></div><div>That last command outputs the following error messages:<br><br></div><div><i>    $ lxc exec cn1 -- chmod +x /home/$USER/*.sh<br>    chmod: cannot access '/home/bmullan/createlxc.sh': No such file or directory<br>    chmod: cannot access '/home/bmullan/deletelxc.sh': No such file or directory<br>    chmod: cannot access '/home/bmullan/mkcn.sh': No such file or directory</i><br><br><br></div><div>However, those .sh files are on my Host in /home/bmullan NOT the ones I pushed<br></div><div>to cn1 in /home/bmullan ?<br><br></div><div>Am I using lxc exec incorrectly somehow ?<br><br></div><div>thanks for any advice.<br><br></div><div>Brian<br><br></div><div><br></div><div><br><br><br><br><br></div></div>