Results 1 to 4 of 4
Hello, i have an assignment to where i need to change
files and directory permissions.
the problem is that when i use chmod(filename,mode)
on files it works fine.
but when ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-27-2013 #1Just Joined!
- Join Date
- Jan 2013
- Posts
- 2
Help with chmod or mode_t..
Hello, i have an assignment to where i need to change
files and directory permissions.
the problem is that when i use chmod(filename,mode)
on files it works fine.
but when i use that on directories, it does not.
i have no idea as to why.. tried several approaches and
still got stuck.
please can anyone point me to solving this?
- 01-27-2013 #2
Please show us the exact commands that you were using for files and directories, and then we might be able to point you in the right direction.
Great GNU/Linux references and resources:
The Linux Documentation Project
Rute User's Tutorial and Exposition
GNU/Linux Man Pages
- 01-27-2013 #3Just Joined!
- Join Date
- Jan 2013
- Posts
- 2
first i defined an int with the permission required, say i = 775
i have a char *name which is the name of the file/directory.
then i use the line
chmod(name,i);
- 01-27-2013 #4
It doesn't look like you're using enough digits for the mode. Try using 5 digits instead of 3. I'll leave you to figure out what to prefix it with, but I'll give you a clue that it's what you use if you don't want any permissions at all.
Great GNU/Linux references and resources:
The Linux Documentation Project
Rute User's Tutorial and Exposition
GNU/Linux Man Pages


Reply With Quote
