Discussion:
Can non-root user create/start services?
K Lu
2021-05-16 01:24:19 UTC
Permalink
As subject asks. The scenario is that I want to mount a cloud storage fuse
using rclone[1]. But this only makes sense at user level, not system wide.

If I cannot then what would be the suggestion?

Thanks!
K

[1]:
https://rclone.org/commands/rclone_mount/
Jonesy via freebsd-questions
2021-05-16 17:52:51 UTC
Permalink
Post by K Lu
As subject asks. The scenario is that I want to mount a cloud storage fuse
using rclone[1]. But this only makes sense at user level, not system wide.
If I cannot then what would be the suggestion?
sshfs -p 22 -- ***@example.net:/home/userid/ $HOME/-mount-point-/

... using public/private key for login.

Later, to unmount:

fusermount -u $HOME/-mount-point-/
Vlad Markov
2021-05-17 13:19:21 UTC
Permalink
On Sun, 16 May 2021 17:52:51 -0000 (UTC)
Post by Jonesy via freebsd-questions
Post by K Lu
As subject asks. The scenario is that I want to mount a cloud storage fuse
using rclone[1]. But this only makes sense at user level, not system wide.
If I cannot then what would be the suggestion?
... using public/private key for login.
fusermount -u $HOME/-mount-point-/
I use smbnetfs which is a fuse mount as a regular user.

MOUNT_CMD="/usr/local/bin/smbnetfs"
MOUNT_PT="/home/vlad/share"

I followed the directions in the handbook to make this happen.

Its possible your situation is equivalent.


--
K Lu
2021-05-18 18:18:33 UTC
Permalink
Thanks for the tips on FUSE options - I will try them.

And I'm more curious about the general question of "how can a non-root user create/start freebsd services" - Any suggestions :)
Tomasz CEDRO
2021-05-18 19:58:19 UTC
Permalink
Post by K Lu
And I'm more curious about the general question of "how can a non-root user create/start freebsd services" - Any suggestions :)
Why would you like that?

You can set services to start in /etc/rc.conf as root ans just have
them running (with provided parameters).

You can run your own network services on non-restricted ports (above
1024) as standard user.

You can also use sudo to perform root actions as standard user.

In general Unix always separates root (administrator tasks) from users
(non administrative tasks). This is why "gaining root" as
standard/restricted user is always the most interesting part ;-)
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
Tomasz CEDRO
2021-05-18 20:01:05 UTC
Permalink
Post by Tomasz CEDRO
In general Unix always separates root (administrator tasks) from users
(non administrative tasks). This is why "gaining root" as
standard/restricted user is always the most interesting part ;-)
Clarification - any way for your user to perform root operations is
also a good way for others to perform root actions - this is usually a
serious security threat and you want avoid that :-)
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
Tomasz CEDRO
2021-05-18 21:28:09 UTC
Permalink
Right, I don't want to change to root for those tasks.
That's why I'm curious, if the user can define and start "per-user"
services. Not sure if I elaborate the use cases well :)
Another option I can think of is using user cron jobs. Are there other options?
Cron is good to run periodic tasks - every hour, day, week, month.

You may want to put your local services into ~/.profile but that
requires login for them to be launched. They would not launch at boot.

You may set a system service to run as selected local user (i.e. vbox)
so you can access and probably control them as selected user (i.e.
manually kill, kill -HUP, start beyond system service).

You may put some services or script into /etc/rc.d/local that would
launch your local user services.

You may provide a web interface to see status and provide
enable/disable switch if you do not even want to login.

Either way you would probably have to create a control
(start/stop/status) scripts for your local services in your home
directory (i.e. $HOME/.local/etc/rc.d/). They could be started with
/etc/rc.d/local at boot or periodically controlled by cron - when not
running start would take place, when running no action taken, when
crashed they would start again.

Cron will however execute them no matter if you like it or not, so
either you edit your cron (crontab -e) or some additional
enable/disable flag for a service would have to be part of your local
configuration scripts.

You may take a look at /etc/rc.d/local as an example :-)

Good luck! :-)
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
Steve O'Hara-Smith
2021-05-18 22:33:38 UTC
Permalink
On Tue, 18 May 2021 23:28:09 +0200
Post by Tomasz CEDRO
Right, I don't want to change to root for those tasks.
That's why I'm curious, if the user can define and start "per-user"
services. Not sure if I elaborate the use cases well :)
Another option I can think of is using user cron jobs. Are there other options?
Cron is good to run periodic tasks - every hour, day, week, month.
You may want to put your local services into ~/.profile but that
requires login for them to be launched. They would not launch at boot.
They would also launch for every login.
--
Steve O'Hara-Smith <***@sohara.org>
Steve O'Hara-Smith
2021-05-19 06:05:56 UTC
Permalink
On Tue, 18 May 2021 13:52:40 -0700
Another option I can think of is using user cron jobs. Are there other
options?
User crontab entries with @reboot as the time,
--
Steve O'Hara-Smith <***@sohara.org>
Loading...