Git Product home page Git Product logo

Comments (6)

ZenithalHourlyRate avatar ZenithalHourlyRate commented on July 4, 2024

你好,goauthing@<username>.service 不是通过 systemctl --user 激活的(@NickCao 打的包倒确实是这样激活的,@ouuan 的不是)

正确的激活方式是在 root 用户下 systemctl start goauthing@<username>

另外,如果需要开机即激活并定时认证,可以在 root 用户下

systemctl enable --now goauthing@<username>.timer

我的 timer 样例如下,我似乎忘了 commit 上来……

[Unit]

[Timer]
OnBootSec=60
OnUnitActiveSec=2min
#OnCalendar=hourly

[Install]
WantedBy=timers.target

from goauthing.

Sphekes avatar Sphekes commented on July 4, 2024

非常感谢您的解答。使用sudo systemctl start/enable确实可以正常运行,但是我还有一些疑问:

auth-thu-bin这个包将一系列goauthing.serivce放在了/usr/lib/systemd/user/,这一目录是用来放用户单元文件的,用systemctl --user管理的,而用系统级的systemctl是找不到这一文件的。我是将这一文件拷贝到/etc/systemd/system/中才可以运行的。所以有没有可能是维护者打包打错了啊?

还有就是用系统权限去执行网络验证权限好像有点太高了,这对于个人电脑当然无所谓,但是多用户不知root密码就会很麻烦。尤其是goauthing@<username>.service加了@参数很明显就是想让单个用户去执行的。

from goauthing.

ouuan avatar ouuan commented on July 4, 2024

auth-thu-bin这个包将一系列goauthing.serivce放在了/usr/lib/systemd/user/,这一目录是用来放用户单元文件的,用systemctl --user管理的,而用系统级的systemctl是找不到这一文件的。我是将这一文件拷贝到/etc/systemd/system/中才可以运行的。所以有没有可能是维护者打包打错了啊?

很可能是的,我自己没有在用这些 service,直接看的 auth-thu 是放在 /usr/lib/systemd/user 就放了。这个应该是要怎么放呢 🤔 全放 /etc/systemd/system

from goauthing.

NickCao avatar NickCao commented on July 4, 2024

较为安全的做法是将 unit file 置于 /usr/lib/systemd/user/,此时由于本身已经是 user unit,也无需使用template unit (即@<用户名>) 这一方式。不过这一做法有一个缺陷是在默认情况下,user unit 并不会随着系统的启动而启动,但是可以通过 loginctl enable-linger 开启这一行为。

from goauthing.

ZenithalHourlyRate avatar ZenithalHourlyRate commented on July 4, 2024

很可能是的,我自己没有在用这些 service,直接看的 auth-thu 是放在 /usr/lib/systemd/user 就放了。这个应该是要怎么放呢 全放 /etc/systemd/system

用户自己加系统服务是放在 /etc/systemd/system 的,打成包的话是放在 /usr/lib/systemd/system 的。

不过这一做法有一个缺陷是在默认情况下,user unit 并不会随着系统的启动而启动,但是可以通过 loginctl enable-linger 开启这一行为。

这几个 service 是为了开机自认证而服务的(虽然我没扔进来 timer)。既然 loginctl enable-linger 需要 root,那放在 user 然后给用户开机自启和放在 system 然后降格为各个用户所需要的权限是一样的。

多用户的情景中,如果系统管理员知道 auth-thu 然后安装了,如果只有一个管理员,这时候一般会让系统管理员自己配置认证,毕竟密码是明文存放的,其他用户存放密码并不安全。

如果系统管理员不知道,没有 root 权限的用户登录以后自己需要认证,为了方便可以将服务放在 ~/.config/systemd/user/,这时候就需要用户自己修改 service 了(因为二进制路径各不相同)。

在多管理员或用户没有权限的情景下,我们也不推荐使用 service,因为这需要填写 ~/.auth-thu,而(其他)系统管理员能读取到该文件,所以这时我们推荐用户手动调用 auth-thu。

from goauthing.

Sphekes avatar Sphekes commented on July 4, 2024

大概明白了,感谢各位的耐心解答。

之前只会用别人的service文件,自己没有写过调过,看来还是要多加学习。

from goauthing.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.