1

I have a few Ubuntu systems which use the su command from within the rc.local script. This updates a users git repo on the local machine, so its important that the ownership of files is kept to the correct user.

This was working before spectre/meltdown patches, but now I'm getting inconsistent results when the script runs. Some machines are able to run the su command but many say that "su must be ran from a terminal" and the script does not run.

I'm struggling to understand what has changed in the last updates that would break this.

  • I can't tell you what may have changed - but you might consider trying sudo -u in place of su – steeldriver Feb 23 '18 at 13:36
  • Thank you kindly, that resolved the issue. I feel rather silly for asking now. – fyberoptik Mar 28 '18 at 13:42
1

Unsure why su -s stopped working like it did before, but sudo -u username does resolve the issue.

I did have to chain the commands together to change directory as sudo -u username resets the working directory to the user's home directory:

sudo -S -u username -i /bin/bash -l -c 'cd /opt/bin; git reset --hard'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.