How to give PHP permission to use chown
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I want to send a file to server via FTP (I'm using proftpd on a ubuntu server) using a desktop application. Before sending the file, I'm trying to make the directory first. There are two ways that I think will be able to achieve that:
- Make directory using FTP's MKD command
- Post a request to php page and create the directory using PHP
Currently, I'm trying to explore the second option, and it works except for one thing: the directory that I'm making is owned by www-data instead of the FTP user (let's say it is named "person"). In order to ensure that "person" can put file in the directory made by PHP, I did these things
- Assign "person" to the same group as www-data
- Make the directory with 0770 permission
- Edit proftpd.conf so that the parent directory of the one that is made by php is only affected by umask 002
So far I have very little success. The directory I made (via PHP) always have 0750 permission even though I explicitly stated in PHP to give it 0750 and have edited all the umask in proftpd.conf. I even try to comment all the umask to no avail. Therefore, next I want to try using chown to change the ownership of the directory to "person". Unfortunately, I found that chown can only be used by superuser. I tried to add www-data to sudo group, but I still can't use chown. So, what should I do? Or is there any approach to achieve my goal? I'm a total beginner to ubuntu so this really confuse me
php ftp proftpd
add a comment |Â
up vote
0
down vote
favorite
I want to send a file to server via FTP (I'm using proftpd on a ubuntu server) using a desktop application. Before sending the file, I'm trying to make the directory first. There are two ways that I think will be able to achieve that:
- Make directory using FTP's MKD command
- Post a request to php page and create the directory using PHP
Currently, I'm trying to explore the second option, and it works except for one thing: the directory that I'm making is owned by www-data instead of the FTP user (let's say it is named "person"). In order to ensure that "person" can put file in the directory made by PHP, I did these things
- Assign "person" to the same group as www-data
- Make the directory with 0770 permission
- Edit proftpd.conf so that the parent directory of the one that is made by php is only affected by umask 002
So far I have very little success. The directory I made (via PHP) always have 0750 permission even though I explicitly stated in PHP to give it 0750 and have edited all the umask in proftpd.conf. I even try to comment all the umask to no avail. Therefore, next I want to try using chown to change the ownership of the directory to "person". Unfortunately, I found that chown can only be used by superuser. I tried to add www-data to sudo group, but I still can't use chown. So, what should I do? Or is there any approach to achieve my goal? I'm a total beginner to ubuntu so this really confuse me
php ftp proftpd
"Make the directory with 0770 permission", "I tried to add www-data to sudo group" ----> Don't do this. What is wrong about option 1, using FTP? Why do you think, PHP should create directories for the FTP user? Also, please add some code for what you tried with PHP. Anyways I think, you should rather seek help at stackoverflow, because this is not really about Ubuntu.
â RoVo
Apr 12 at 8:24
@RoVo I thought creating directories with PHP is easier than working with FTP. Apparently I'm totally wrong here. The truth is, I'm confused of where I should post this question, here or at stackoverflow as this problem consists of PHP and Ubuntu part. I realized that many things that I tried doing are mostly on Ubuntu, so I decided to post my question here and left the code part. I guess I'll try tinkering with FTP to get what I want. Thanks!
â Rizky Prasetya
Apr 13 at 1:39
Option 1 is definitely the way to go!!! and set the security back to what it was, please! You're opening yourself up to a big, fat security hole!
â Fabby
Apr 18 at 20:50
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to send a file to server via FTP (I'm using proftpd on a ubuntu server) using a desktop application. Before sending the file, I'm trying to make the directory first. There are two ways that I think will be able to achieve that:
- Make directory using FTP's MKD command
- Post a request to php page and create the directory using PHP
Currently, I'm trying to explore the second option, and it works except for one thing: the directory that I'm making is owned by www-data instead of the FTP user (let's say it is named "person"). In order to ensure that "person" can put file in the directory made by PHP, I did these things
- Assign "person" to the same group as www-data
- Make the directory with 0770 permission
- Edit proftpd.conf so that the parent directory of the one that is made by php is only affected by umask 002
So far I have very little success. The directory I made (via PHP) always have 0750 permission even though I explicitly stated in PHP to give it 0750 and have edited all the umask in proftpd.conf. I even try to comment all the umask to no avail. Therefore, next I want to try using chown to change the ownership of the directory to "person". Unfortunately, I found that chown can only be used by superuser. I tried to add www-data to sudo group, but I still can't use chown. So, what should I do? Or is there any approach to achieve my goal? I'm a total beginner to ubuntu so this really confuse me
php ftp proftpd
I want to send a file to server via FTP (I'm using proftpd on a ubuntu server) using a desktop application. Before sending the file, I'm trying to make the directory first. There are two ways that I think will be able to achieve that:
- Make directory using FTP's MKD command
- Post a request to php page and create the directory using PHP
Currently, I'm trying to explore the second option, and it works except for one thing: the directory that I'm making is owned by www-data instead of the FTP user (let's say it is named "person"). In order to ensure that "person" can put file in the directory made by PHP, I did these things
- Assign "person" to the same group as www-data
- Make the directory with 0770 permission
- Edit proftpd.conf so that the parent directory of the one that is made by php is only affected by umask 002
So far I have very little success. The directory I made (via PHP) always have 0750 permission even though I explicitly stated in PHP to give it 0750 and have edited all the umask in proftpd.conf. I even try to comment all the umask to no avail. Therefore, next I want to try using chown to change the ownership of the directory to "person". Unfortunately, I found that chown can only be used by superuser. I tried to add www-data to sudo group, but I still can't use chown. So, what should I do? Or is there any approach to achieve my goal? I'm a total beginner to ubuntu so this really confuse me
php ftp proftpd
php ftp proftpd
asked Apr 12 at 7:32
![](https://lh6.googleusercontent.com/-kmv_rt0k9bw/AAAAAAAAAAI/AAAAAAAAACM/jt5UeG7NdmY/photo.jpg?sz=32)
![](https://lh6.googleusercontent.com/-kmv_rt0k9bw/AAAAAAAAAAI/AAAAAAAAACM/jt5UeG7NdmY/photo.jpg?sz=32)
Rizky Prasetya
1
1
"Make the directory with 0770 permission", "I tried to add www-data to sudo group" ----> Don't do this. What is wrong about option 1, using FTP? Why do you think, PHP should create directories for the FTP user? Also, please add some code for what you tried with PHP. Anyways I think, you should rather seek help at stackoverflow, because this is not really about Ubuntu.
â RoVo
Apr 12 at 8:24
@RoVo I thought creating directories with PHP is easier than working with FTP. Apparently I'm totally wrong here. The truth is, I'm confused of where I should post this question, here or at stackoverflow as this problem consists of PHP and Ubuntu part. I realized that many things that I tried doing are mostly on Ubuntu, so I decided to post my question here and left the code part. I guess I'll try tinkering with FTP to get what I want. Thanks!
â Rizky Prasetya
Apr 13 at 1:39
Option 1 is definitely the way to go!!! and set the security back to what it was, please! You're opening yourself up to a big, fat security hole!
â Fabby
Apr 18 at 20:50
add a comment |Â
"Make the directory with 0770 permission", "I tried to add www-data to sudo group" ----> Don't do this. What is wrong about option 1, using FTP? Why do you think, PHP should create directories for the FTP user? Also, please add some code for what you tried with PHP. Anyways I think, you should rather seek help at stackoverflow, because this is not really about Ubuntu.
â RoVo
Apr 12 at 8:24
@RoVo I thought creating directories with PHP is easier than working with FTP. Apparently I'm totally wrong here. The truth is, I'm confused of where I should post this question, here or at stackoverflow as this problem consists of PHP and Ubuntu part. I realized that many things that I tried doing are mostly on Ubuntu, so I decided to post my question here and left the code part. I guess I'll try tinkering with FTP to get what I want. Thanks!
â Rizky Prasetya
Apr 13 at 1:39
Option 1 is definitely the way to go!!! and set the security back to what it was, please! You're opening yourself up to a big, fat security hole!
â Fabby
Apr 18 at 20:50
"Make the directory with 0770 permission", "I tried to add www-data to sudo group" ----> Don't do this. What is wrong about option 1, using FTP? Why do you think, PHP should create directories for the FTP user? Also, please add some code for what you tried with PHP. Anyways I think, you should rather seek help at stackoverflow, because this is not really about Ubuntu.
â RoVo
Apr 12 at 8:24
"Make the directory with 0770 permission", "I tried to add www-data to sudo group" ----> Don't do this. What is wrong about option 1, using FTP? Why do you think, PHP should create directories for the FTP user? Also, please add some code for what you tried with PHP. Anyways I think, you should rather seek help at stackoverflow, because this is not really about Ubuntu.
â RoVo
Apr 12 at 8:24
@RoVo I thought creating directories with PHP is easier than working with FTP. Apparently I'm totally wrong here. The truth is, I'm confused of where I should post this question, here or at stackoverflow as this problem consists of PHP and Ubuntu part. I realized that many things that I tried doing are mostly on Ubuntu, so I decided to post my question here and left the code part. I guess I'll try tinkering with FTP to get what I want. Thanks!
â Rizky Prasetya
Apr 13 at 1:39
@RoVo I thought creating directories with PHP is easier than working with FTP. Apparently I'm totally wrong here. The truth is, I'm confused of where I should post this question, here or at stackoverflow as this problem consists of PHP and Ubuntu part. I realized that many things that I tried doing are mostly on Ubuntu, so I decided to post my question here and left the code part. I guess I'll try tinkering with FTP to get what I want. Thanks!
â Rizky Prasetya
Apr 13 at 1:39
Option 1 is definitely the way to go!!! and set the security back to what it was, please! You're opening yourself up to a big, fat security hole!
â Fabby
Apr 18 at 20:50
Option 1 is definitely the way to go!!! and set the security back to what it was, please! You're opening yourself up to a big, fat security hole!
â Fabby
Apr 18 at 20:50
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1024268%2fhow-to-give-php-permission-to-use-chown%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
"Make the directory with 0770 permission", "I tried to add www-data to sudo group" ----> Don't do this. What is wrong about option 1, using FTP? Why do you think, PHP should create directories for the FTP user? Also, please add some code for what you tried with PHP. Anyways I think, you should rather seek help at stackoverflow, because this is not really about Ubuntu.
â RoVo
Apr 12 at 8:24
@RoVo I thought creating directories with PHP is easier than working with FTP. Apparently I'm totally wrong here. The truth is, I'm confused of where I should post this question, here or at stackoverflow as this problem consists of PHP and Ubuntu part. I realized that many things that I tried doing are mostly on Ubuntu, so I decided to post my question here and left the code part. I guess I'll try tinkering with FTP to get what I want. Thanks!
â Rizky Prasetya
Apr 13 at 1:39
Option 1 is definitely the way to go!!! and set the security back to what it was, please! You're opening yourself up to a big, fat security hole!
â Fabby
Apr 18 at 20:50