Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


chmod with CInternetFile or CFTPConnection

Posted on 2003-03-06
Medium Priority
Last Modified: 2013-11-20

I'm transfering files with help of the MFC-Classes CInternetConnection and CFTPConnection. The problem is that the files does not have enough permissions on the target server. I can not find any methode to change the file permissions. Is there any other way ? I did not find a methode for permissions within the CInternetFile, too.

What could I do ?
Question by:DennisWood
  • 3
  • 2
  • 2

Expert Comment

ID: 8080571
What do you mean change permissions???
The files sould take the default permission of the shell
(if you're in unix) which is set with the umask command...

You want to setuided the files so that there executed by a
admin account or someting like that os a remote system???
On a windoze marchine or a unix one?


Author Comment

ID: 8081338
I mean the unix file access permissions on the linux-ftp-server. In usual ftp-clients it is possible to transfer a file to a ftp server and then change the permissions, e.g. to rw-rw-rw- (666).

I don't want to change anything on the ftp-server !

The "client" I write under windoze with the MFC

Expert Comment

ID: 8081479
So If I understand correctly...
A windoze client upload a file on a unix ftp server.
But it turns out that the dile on the unix machine has the
wrong file permission (like 444) and you are wondering how to
chmod the file from the client side AFTER it has been uploaded...

I think once the file has been transfered from the client it is too late...

Several options are available on the unix side...
a cron job which chmod all file in the upload area at regular
interval seems the simplest...

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 49

Expert Comment

ID: 8094844
>>I don't want to change anything on the ftp-server !

If you want to change the file permissions on the server, then how can this be true?  Perhaps you need to provide mpore information.  Are you talking about downloading files from the server or uploading files to it?

-- Dan

Author Comment

ID: 8111780
I'm talking about uploading.
It would be enough to give the file the correct permissions, e.g. 444, in the moment I upload it.
LVL 49

Expert Comment

ID: 8113788
Wouldn't allowing the client to set the permissions be a serious security breach?  For instance, if the server was set to disallow execution, then if the client were to be allowed to simply override that setting... well, it makes me shudder.  Even something as simple as allowing the client to change a read-only file to a read-write could be disasterous.

-- Dan

Accepted Solution

aquila98 earned 300 total points
ID: 8113959
I think is you set up a default shell for the anonymous user
account (or whatever user you use to ftp and upload) with
the umask command like umask 444 (assuming you're under Solaris... Other unix might have another syntax for that command, check the man page)... That way ANY files created
by that shell would have 444 by default... As long as the user can cd to a folder and pass along the 444 permission up to
the file thru the folders...

This info is kelp in /etc/passwd or /etc/login forget which...
If I remember enaugh my unix days this might work...


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question