Skip to main content

Timeline for Creating a user without a password

Current License: CC BY-SA 4.0

11 events
when toggle format what by license comment
Apr 28, 2022 at 12:24 history edited terdon CC BY-SA 4.0
edited body
Jul 7, 2020 at 21:28 comment added alper Thanks @Gilles'SO-stopbeingevil' // Ah I forget to use sh, now it works
Jul 7, 2020 at 21:20 comment added Gilles 'SO- stop being evil' @alper You didn't use the commands I posted. You used one of many variants (too many for me to guess the exact one) that would result in this particular error. You need to invoke a shell for cd and &&.
Jul 7, 2020 at 21:12 comment added alper It does not allow me to do cd I am not sure why sudo: cd: command not found. But I am able to do other solutions
Jul 7, 2020 at 20:02 comment added Gilles 'SO- stop being evil' @alper Write the full path: sudo -u git cat /wherever/main.py. Or add a cd command: sudo -u git sh -c 'cd /wherever && cat main.py'. If you want to be sure that the other user doesn't get access to the current directory even if the command doesn't do what was intended, change directories outside: (cd /wherever && sudo -u git cat main.py)
Jul 7, 2020 at 19:50 comment added alper When I do sudo su git -c "cat main.py" it can read the files where sudo operation is perform. Is it possible to prevent that forcing switched user to run the command in its home directory rather than main user's directory?
Jul 7, 2020 at 19:40 comment added Gilles 'SO- stop being evil' @alper This has nothing to do with my answer. But anyway, yes, it does.
Jul 7, 2020 at 19:15 comment added alper Ubuntu 19.10 seems like does not have --disabled-password parameter, could there be any alternative solution
Dec 7, 2019 at 7:51 comment added pylover Another one: sudo su - git git init
Nov 27, 2012 at 5:51 vote accept Erik
Nov 27, 2012 at 1:13 history answered Gilles 'SO- stop being evil' CC BY-SA 3.0