Welcome
|
FAQ
|
Downloads
|
Wiki
Tiny Core Linux
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Raspberry Pi port,
piCore-15.0
is available!
Home
Help
Login
Register
Tiny Core Linux
»
General TC
»
Programming & Scripting - Unofficial
»
How to create dir with tc.staff ownership with extension startup
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: How to create dir with tc.staff ownership with extension startup (Read 3280 times)
jur
Hero Member
Posts: 863
How to create dir with tc.staff ownership with extension startup
«
on:
June 29, 2010, 07:32:01 PM »
Sorry for this question... it comes from being a linux newbie...
I am creating an extension and with a startup script want to conditionally create a dir under $HOME/.config. But the one that is created has root:staff ownership. How would I create one with tc:staff owner while being root? I have looked around but not found an answer...
Logged
gerald_clark
TinyCore Moderator
Hero Member
Posts: 4254
Re: How to create dir with tc.staff ownership with extension startup
«
Reply #1 on:
June 29, 2010, 07:54:20 PM »
A user can cannot create files owned by another user.
Root will have to temporarily change to user tc with the su command.
EX: su -c 'touch junk' tc
Or ( as root ) change the owner.
EX: touch junk ; chown tc.staff junk
Logged
jur
Hero Member
Posts: 863
Re: How to create dir with tc.staff ownership with extension startup
«
Reply #2 on:
June 30, 2010, 08:30:15 PM »
Thanks, that helped me to a solution.
Logged
SvOlli
Full Member
Posts: 193
Linux Developer
Re: How to create dir with tc.staff ownership with extension startup
«
Reply #3 on:
July 03, 2010, 05:31:21 PM »
jur, keep in mind that there are users that use the "user=xxx" command line parameter to switch to a user different from "tc". You'll need to use the environment variable "$USER" instead of a hard-coded "tc".
Logged
jur
Hero Member
Posts: 863
Re: How to create dir with tc.staff ownership with extension startup
«
Reply #4 on:
July 04, 2010, 01:44:57 AM »
Yes I realise that; I did actually try that in the 1st round and found $USER to be root.
So I haven't got it going fully generic yet.
Logged
SvOlli
Full Member
Posts: 193
Linux Developer
Re: How to create dir with tc.staff ownership with extension startup
«
Reply #5 on:
July 04, 2010, 01:56:36 AM »
Hmmm... that's a bit strange, since USER gets set in /etc/init.d/tc-config. Didn't dig deep enough before the last post.
Anyway, as an alternative you can read the user from /etc/sysconfig/tcuser.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Tiny Core Linux
»
General TC
»
Programming & Scripting - Unofficial
»
How to create dir with tc.staff ownership with extension startup