Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only display a Microsoft Login to the user #363

Closed
Lenni-builder opened this issue Nov 2, 2023 · 5 comments
Closed

Only display a Microsoft Login to the user #363

Lenni-builder opened this issue Nov 2, 2023 · 5 comments

Comments

@Lenni-builder
Copy link

Is there any way to run OneDriver from the Terminal so the only thing displayed to the end user is a Microsoft login page? That would be needed to have it setup for school computers where the local user account is reset every time you log in.

@Lenni-builder
Copy link
Author

Lenni-builder commented Nov 2, 2023

What I basically need is a Microsoft login after you log into the local user account. After you log in to your MS account it should automatically show your OneDrive files in a folder like ~/OneDrive.

@jstaf
Copy link
Owner

jstaf commented Nov 5, 2023

Yeah, just run onedriver ~/OneDrive and it will pop up with a login page and start the app.

If you want this to be automatic (have the user login on startup no matter what for all users), you'll need to create a copy of the the unit file and globally enable the systemd user service for the new unit. Basically systemd is what actually launches all of the mountpoints through the GUI, so you can do the same thing with a default mountpoint if you are clever with the unit file.

# creat copy of unit file to enable globally
cp /usr/lib/systemd/user/onedriver@.service /etc/systemd/user/onedriver-global@.service

# in /etc/systemd/user/onedriver-global@.service, change this:
# (ignore the #commented bits, I am just explaining what each line normally does...
# %f is the part between "onedriver@" and ".service" when coming up with the unit name)
ExecStart=/usr/bin/onedriver %f   # on unit start, mount onedrive at %f 


# to this:
ExecStart=/usr/bin/onedriver %h/%f  # on unit start, mount onedrive at ~/%f for each user

Then you can enable it globally for all users with systemctl enable --global onedriver-global@OneDrive.service to mount OneDrive by default at ~/OneDrive. I think this should work, but after some googling, user's won't be able to disable the unit normally, only mask it (hide it from systemd altogether): https://superuser.com/a/1358461

Disclaimer: I haven't actually tried any of this out.

If end users could list/mask/unmask the global units through the UI, this would be a nice feature to have for enterprise folks, especially when combined with #347 (a global configuration file to configure all the mountpoints globally), and #318 (so end users/admins can see mistakes with auth, like admins accidentally not allowing third-party apps).

@Lenni-builder
Copy link
Author

@jstaf Thanks, that's already very helpful. I'd just run the command from a script I'd set as a startup application in Plasma. Just one question: Does the command output an exit code after successfully logging in?

@jstaf
Copy link
Owner

jstaf commented Nov 5, 2023

So if you want it to just authenticate and then exit, add -a... so onedriver -a ~/OneDrive would make it so that user's OneDrives show up in the GUI app, but not actually start the drive. Successful authentication ends with exit code 0 (and 1 on failure).

Otherwise onedriver ~/OneDrive stays running in the foreground until the user kills/unmounts it somehow. (If you want the drive to run as a daemon in the background, that's what the systemd user service is for. The GUI just literally starts/stops/enables the daemon.)

@jstaf jstaf mentioned this issue Nov 11, 2023
@Lenni-builder
Copy link
Author

I think that's enough for me to figure it out. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants