Gentoo Archives: gentoo-user

From: Fernando Rodriguez <cyklonite@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] executing a command as a nologin user
Date: Wed, 13 Jul 2016 11:28:56
Message-Id: b0f2934d-14ef-7fcc-3023-be23879ddf50@gmail.com
In Reply to: Re: [gentoo-user] executing a command as a nologin user by Alan McKinnon
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 On 07/13/2016 07:10 AM, Alan McKinnon wrote:
5 > On 12/07/2016 03:47, jens w wrote:
6 >> .procmailrc
7 >> :0 c
8 >> * !^X-Loop: name@×××××××.com
9 >> | formail -X "From:" | $HOME/bin/script.sh
10 >>
11 >> procmail.log
12 >> procmail: Executing " formail -X "From:" | $HOME/bin/script.sh
13 >>
14 >> for incoming mail, a script is executed. logfile has the same entry as
15 >> it is in other users. but the script do nothing.
16 >>
17 >> How executing a command as a nologin user?
18 >>
19 >
20 >
21 > You can't, not the way you are doing it.
22 > You want to launch a shell script for the user, but the user's shell is /sbin/nologin. This exits immediately without launching the script.
23 >
24 > Give the user a real shell.
25 >
26 > Alan
27 >
28
29 I've been following this thread and thinking the same thing but wasn't sure.
30
31 What if you invoke the shell directly instead of the script, either:
32 /bin/sh -c "<path to script>" or /bin/sh -c "$(cat <script>)"?
33
34 If procmail uses the system() call to launch the script it won't work but if it
35 uses fork()/exec() or similar I think that it should work.
36
37
38 -----BEGIN PGP SIGNATURE-----
39 Version: GnuPG v2
40
41 iQIcBAEBCAAGBQJXhiYYAAoJEPbOFX/5Ulwcof0P/3KcoZ2vKh7cHoLdR7njoggC
42 L+4Qpe5Fjs1jM38SUq3RWfiSZrG4rmfmI38uBMQ1yLGN/fU5lhUsjlnLfxCdAYxu
43 AyoWiEdbFYKN/iIssLdxQgnPxQDmjKJzcVUEIZhJwz+xEV0bjM3eejX0UzjIgoM7
44 Bx2bqlBe010zva9uvE1msHxz/S7K8KetGBJt8RvXhpYJcQJuYLU3iKyNvBGzzKMx
45 0dkr0AybZHbgrGqgDCbkZzI9AOx7ydK0TEeeVrMmA/oFSkdJ5hAEhw2tnbt68Adb
46 2268/QLwswRQ5C5s6r3SRv+xcqaOixvZxjDTahAdEziz60+Gyyv03Edmeeio7rPg
47 /vCOMjdboTSGPRPKtOJXoHgIMh4aRqY6MA/hC8/h9WuVg9xJN0elCgef4XRN+sUR
48 GSxb59o2ITvzoxUqu19YmYerS1Ec4lIqdcrVLofHsRBXUNfYrQ73kYgha2YVaqp8
49 gicY8kKlCKUdztS7tFt+lk6oP1cJhXGj5vxdbncShr6BFWkB63CDb4NNPYGWgKOZ
50 ly1uZxznw1Stim6p+I2EkY5WsK82EUjmYohiIdW1La1jYc4P43eASrx6suvCXIS0
51 95cs6qcauFtv4V6wZwnzI2w2T2yHAjAGPvmIwtfn6SgYyE5il8TkrML/EX1n2pDO
52 5YTP9IuRZE92rOysBo3X
53 =IkJx
54 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-user] executing a command as a nologin user wabe <wabenbau@×××××.com>
Re: [gentoo-user] executing a command as a nologin user wabe <wabenbau@×××××.com>