Timeline for Using chown $USER:$USER inside bash script
Current License: CC BY-SA 3.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 25, 2022 at 13:22 | answer | added | tearfur | timeline score: 2 | |
| Aug 21, 2016 at 5:43 | answer | added | Eric James Deiter | timeline score: 5 | |
| Jul 9, 2016 at 12:30 | answer | added | Andreas Bartels | timeline score: -1 | |
| Apr 27, 2016 at 17:56 | vote | accept | BrassApparatus | ||
| May 22, 2015 at 10:38 | comment | added | 0xC0000022L | Use chmod user: <file> to chown to the user and his primary group. | |
| May 22, 2015 at 9:06 | answer | added | marram | timeline score: 2 | |
| May 22, 2015 at 8:48 | answer | added | Tim Cutts | timeline score: 10 | |
| Feb 7, 2015 at 14:24 | comment | added | ott-- | Try using $U or anything else, but not $USER, because this variable is special for sudo. See man sudo section ENVIRONMENT. | |
| Feb 7, 2015 at 10:39 | comment | added | Celada | @BrassApparatus I guess technically you'd want to use $(id -nu):$(id -ng) to get the user and the group. | |
| Feb 7, 2015 at 10:32 | comment | added | BrassApparatus | @Celada Like $(id -nu):$(id -nu) or simply $(id -nu) in place of both? | |
| Feb 7, 2015 at 10:03 | comment | added | Celada | Maybe try $(id -nu) instead of $USER? | |
| Feb 7, 2015 at 9:44 | comment | added | BrassApparatus | @myaut I run it manually from the terminal. | |
| Feb 7, 2015 at 9:43 | history | edited | BrassApparatus | CC BY-SA 3.0 | Added script |
| Feb 7, 2015 at 9:41 | comment | added | BrassApparatus | @MarkPlotnick Evidently, USER is root. With the edit I've made do you think you can explain how to chown the file to whichever non-root user executes the script? | |
| Feb 5, 2015 at 22:12 | comment | added | Mark Plotnick | Check if the USER variable is even seen by the script. If you add a line to your script that says echo USER is $USER, what does it print out? | |
| Feb 5, 2015 at 20:31 | comment | added | myaut | $USER variable is set during interactive login. How do you run your script - from login session or using cron or from daemon? | |
| Feb 5, 2015 at 20:20 | comment | added | Cyrus | Is there a group named $USER? getent group $USER | |
| Feb 5, 2015 at 20:11 | review | First posts | |||
| Feb 5, 2015 at 20:15 | |||||
| Feb 5, 2015 at 20:11 | history | asked | BrassApparatus | CC BY-SA 3.0 |