<div dir="ltr"><div>The error i see in auth.log is that i'm already in a session and it cannot start a session for user paul.<br><br></div>I do believe i setup /etc/pam.d/sudo properly.<br><div><br>paul ~ 12:40:07 $ cat /proc/self/cgroup<br>9:perf_event:/<br>8:memory:/<br>7:cpuset:/<br>6:devices:/user.slice<br>5:blkio:/<br>4:cpu,cpuacct:/<br>3:freezer:/<br>2:net_cls,net_prio:/<br>1:name=systemd:/user.slice/user-1000.slice/session-6.scope<br><br></div><div>Why isn't it as simple as moving into this cgroup or changing its settings?<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 10, 2015 at 12:19 PM, Fajar A. Nugraha <span dir="ltr"><<a href="mailto:list@fajar.net" target="_blank">list@fajar.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Oct 10, 2015 at 9:52 PM, Paul Jones <<a href="mailto:spacefreak18@gmail.com">spacefreak18@gmail.com</a>> wrote:<br>
> Thanks for you answers Fajar. The technology is still in it's infancy, so<br>
> I'm not surprised with the need to abuse sudo in this manner, and am willing<br>
> to work around it.<br>
<br>
</span>If everything you tested fail, the sure-fire workaround would be just<br>
to setup passwordless key-based ssh authentication for your user, so<br>
you can do something like<br>
<br>
ssh user@localhost lxc-autostart<br>
<span class=""><br>
><br>
> But i'm not sure I completely follow what you are saying. I get the error<br>
> that you are mentioning from systemd, where it is already running in a<br>
> session. But i can also start the service after boot manually and not get<br>
> that error, and it will create the cgroup, but as usual, i cannot as normal<br>
> user move a process to that cgroup, it get an invalid request error.<br>
><br>
<br>
</span>You don't move your process as a normal user. You get root to create a<br>
cgroup for you (including the correct permission), and use that<br>
(possibly creating a cgroup under that). The easiest way would be to<br>
abuse pam_systemd, which creates<br>
/user.slice/user-X.slice/session-N.scope , where X is uid and N is<br>
session identifier.<br>
<span class=""><br>
<br>
> And I can follow your steps 1-3 already.<br>
><br>
> My questions are on step 4. My output looks nothing like yours and I do not<br>
> understand why you're moving the current tty into the / cgroup which is<br>
> where it already resides?<br>
><br>
<br>
</span>Does it already reside there?<br>
<br>
I haven't tested what cgroup systemd services are put in by default,<br>
but my guess is it's NOT "/".<br>
<br>
And when you login as root, you should be on<br>
/user.slice/user-0.slice/session-N.scope cgroup, and pam_systemd will<br>
refuse to create a new cgroup for the normal user if you're already in<br>
a user session (including root's session)<br>
<span class=""><br>
<br>
> My output looks like this:<br>
><br>
> root@ZitZ:/home/paul# bash -c 'cgm movepidabs all / $$ && sudo -u paul -i<br>
> cat /proc/self/cgroup'<br>
> 9:perf_event:/<br>
> 8:memory:/<br>
> 7:cpuset:/<br>
> 6:devices:/<br>
> 5:blkio:/<br>
> 4:cpu,cpuacct:/<br>
> 3:freezer:/<br>
> 2:net_cls,net_prio:/<br>
> 1:name=systemd:/<br>
<br>
</span>Then pam_systemd doesn't work.<br>
What's in /var/log/auth.log when you execute the above command?<br>
Did you forget to add entry for pam_loginuid before pam_systemd?<br>
What does "cat /proc/self/cgroup" say when you login as user "paul",<br>
either with ssh or from console?<br>
<br>
Again, the goal is NOT to create a new cgroup that a normal user can<br>
"move" into.<br>
Rather, it's to create the SAME cgroup setting that you get when you<br>
LOGIN from ssh/console, where you're already assigned to a cgroup that<br>
you can control, and where a normal user can start an unprivileged<br>
container.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Fajar<br>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Time To Get an EKG, G!</div>
</div>