You are not logged in.
Pages: 1
So I have an interesting one here. So I am making an installation script for WP and I is working well so far however one small detail. Since this is being created from root in this script I have to chown the entire created directory to the user. So my current code is as follows.
echo 'What domain do you want this installed on?'
read domain
mkdir $domain
chown -R $name:$name $domain
cd $domain
Whats odd is using the -R flag in a stand alone command works as it should, as is the variable through out the rest of the script. Is there something i'm missing since it's a script and not a stand alone bash command?
Offline
Sorry I didn't clarify that in my initial reply. This is just clip of the script. There is a assignment of $name earlier in the script that creates $name as the user name for the database/user name. So that is working too because after I run it I get this.
[root@luigi vhosts]# stat halpmysite.com/
Access: (0755/drwxr-xr-x) Uid: ( 509/halpmysite) Gid: ( 509/halpmysite)
So it is chown'ing the actual directory it's creating but it's not doing it recursively as it should be :-\
Offline
What do you mean? You just created the directory with mkdir, there's nothing in it to be recursively chowned.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Wow, nevermind Faconindy and WorMzy, thanks for the interest but I just realized my mistake was a derp on my end. I was doing the chown to early. I was creating the directory but I need to put the chown after the install or else there is nothing to recursively chown. Just moved it down past the install and it's good now. whoops ![]()
Offline
Please remember to mark your thread as [SOLVED] if it is fully resolved.
Also, while it will not affect functionality, there is no need for an "echo" followed by "read" as long as you are using bash - just use a prompt for read:
read -p 'What domain do you want this installed on? ' domainBut if you need full /bin/sh compatibility, the separate commands may be better.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1