Closed mtlynch closed 3 years ago
Maybe you could get cli-login to login as user root
instead of user pi
.
Try changing line 297 from this:
send -- pi\r
To this:
send -- root\r
The root password is disabled by default on Raspberry Pi OS. I guess I could create one and then delete it after, but that's getting a bit complicated.
Would you accept a PR that's sort of like this?
if [ -z "$3" ]; then
LOGIN_USER="$3"
else
LOGIN_USER="pi"
fi
if [ -z "$4" ]; then
LOGIN_PASS="$4"
else
LOGIN_PASS="raspberry"
fi
spawn ${DIRECTORY}/nspawn $mntpnt
expect -re .*login:
send -- "${LOGIN_USER}\r"
expect -re .*Password:
send -- "${LOGIN_PASS}\r"
interact ''
expect eof"
So that users could do:
./vdesktop my.img cli-login my-user my-pass
Adding more cli flags would get exponentially more complicated. cli-login
is already sub-optimal IMHO.
For more advanced options, maybe a conf file would be a better fit. I will think about it.
I couldn't set the username or password to variables - the expect subprocess kept throwing errors and it was getting into a mess.
The only way I could think of was to have a second script that edits the vdesktop
script beforehand, pasting in a username and password. But that did not go well at all.
To me, it looks like the only option left is to manually edit the username and password fields.
I'm able to get it working with variables. I know you're not crazy about additional CLI parameters, but #12 shows a working example of making username and password into variables.
I'm baffled this is possible. I had tried the same thing a few months ago but was never able to get it working using variables. Will look into it and test your code.
OK I've been able to reproduce your results. Turns out my earlier problems were caused by bad syntax and non-escaped quotation marks. I'm currently working on a Botspot-pleasing solution. :)
OK, please check out the new version that I pushed. I've added a config file and have tested a few scenarios, though there may be some bugs. The old version is still accessible at the old-version branch.
Would it be possible to document the new semantics? I'm not sure how the changes affect my previous workflow.
Vdesktop will behave exactly as it did before, but now you have a config file to easily change some settings. The config file is (hopefully) self-explanatory, given the comments I put in it.
Is there any way to delete the
pi
user on an image non-interactively?If I
sudo su
into another user while running undercli-login
, the new user can't deletepi
because it's still running thesudo
session.My current workaround is to just lock the account:
But it would be cool to be able to delete the account entirely.
If I could do non-interactive login with a user other than
pi
/raspberry
, that would make it pretty simple. Is that possible?