Programming :: Comprehending Umask And Mkdir In C++ - Create A Directory With Permissions 755
Apr 27, 2011
I'm having a bit of trouble understanding umask and mkdir in C++. In my program, I want to create a directory with the permissions 755.
If I do:-
Code:
The permissions come out all messed up.
But if I do:-
Code:
The permissions are set as expected.
I am having trouble understanding why umask(0); is needed, and what is the 'proper' way to use it so I can make my directory. From what I can understand from the man pages and everything, I need to set the umask in my program to allow it permission to make a directory with those permissions? And I don't get why umask(0); fixes it anyway!
View 1 Replies
ADVERTISEMENT
Jun 16, 2010
I am a student studying computer science course.
Well, I am facing problem when doing lab questions.
I must use DLXLinux bundled in Bochs (bochs.sourceforge.net).
I am required to use the /usr/local directory.
In /usr directory, there is no directory named 'local' but there is one thing called 'local@'. So, when I try to use mkdir command to create 'local' directory in /usr , there are error "cannot make directory.....".
Look at my screenshot at [url].
View 9 Replies
View Related
Jun 21, 2011
I get the following error whenever I launch bash:
Code:
mkdir: cannot create directory `/dev/cgroup/cpu/user/5900': No such file or directory
bash: /dev/cgroup/cpu/user/5900/tasks: No such file or directory
bash: /dev/cgroup/cpu/user/5900/notify_on_release: No such file or directory
It seems like it's probably from this part of .bashrc:
[Code]...
What does this code do, why, and what's causing it to go wrong?
View 7 Replies
View Related
Apr 14, 2010
I am using Red Hat Linux 4 .There are some few questions in my mind related to umask. I want to know that is the default file and directory permissions ?
- When we use umask (022) command in terminal. and create a new file then the permissions applied for new file is for that session and when the system will reboot linux will take automatically its default permission from etc/bashrc or /etc/profile ?
- Can we make our own umask or the professional way is to follow 022 only ?
- What is the benefit of umask in Linux?
View 2 Replies
View Related
Mar 16, 2011
My Debian system has by default umask permissions of 0022, which I never liked. One user can read all the files of another seems very insecure to me.
I am planing to set it to 007, so that user and group have rw but all others have none.
Are there any side effects to that? I have noticed from a trial I did where I was changing permissions on the filesystem that some system stuff in the OS does not work anymore, if "others" have no read permission anymore, so that is why I am asking.
And why are chmod / umask permissions sometimes stated as 4 digits? What is this "all" group in the end? Isn't that already covered by "others"?
View 1 Replies
View Related
Oct 25, 2010
I am working on SUSE 9 Server in which I am trying to make folder transferdata under /opt folder but it is throwing an error mkdir: cannot create directory `transferdata': Permission denied
View 2 Replies
View Related
Aug 7, 2011
I cannot mkdir on an ancillary HDD
[Code].....
View 2 Replies
View Related
May 24, 2010
i just installed RHEL 5, when iam trying to create a directory or file it is not creating ...
View 7 Replies
View Related
Jan 30, 2010
I'm struggling to understand an aspect of mounting and mountpoints with /etc/fstab. There is a large number of sites and threads that make recommendations using things like uid, gid, umask, and other options. These methods, however, which I've used, are file-system specific, useful only for filesystems such as (V)FAT and NTFS that allow them.My current situation is that I am mounting partition /dev/sdb5 in, let's call it /media/myMount. My goals:Mount this partition automatically upon boot using /etc/fstab...The partition should be fully accessible only to a specific user or group.What I've done is create the mount point in /media:
If user michapma were to carry out the mount, I believe it would work; however, I want the mount to happen automatically during boot. So, how can I achieve my user (or group) permission goals for this and any other such partitions using fstab?The manpage for mount has been helpful, but after reading many tutorials and forum threads, the only way I know how to do it is to have the user do the mounting or rely on the file-system specific options.
View 2 Replies
View Related
Feb 5, 2010
I've written a program which creates a directory using the system call mkdir()
How can i execute 'mkdir -v' using this system call? is there another system call to include options?
View 2 Replies
View Related
May 30, 2010
The setup ( although dont trust anything I say ):
I'm working on an embedded system device using a NFS mounted rootfs ( as shared by my host ) , but I store large video content directly on the device's hdd in /data.
Device's hdd partition /dev/sda3 is ext3 fs mounted at /tmp/mnt/diska3 (rw), then I have a script create dirs like /tmp/mnt/diska3/data and /tmp/mnt/diska3/data/incoming, then symlink :
ln -s /tmp/mnt/diska3/data /data so that the /data appears like any other directory.
I can see /tmp/mnt/diska3/data/incoming. I did chmod -R a+w tmp to rule out permissions.
Running a subsequent script calls mkdir: mkdir -p /data/incoming/gui
BUT fails: mkdir: cannot create directory '/data/': No such file or directory
View 5 Replies
View Related
Feb 19, 2010
I am working on a bash script which among its operations creates directories using the mkdir command. However, when the directory already exists mkdir mentions that in the command line output.
Is there any way I can make mkdir silently overwrite any existent directory? (no messages in the output). For the same price, could it be done with other commands such as cp or mv?
View 3 Replies
View Related
Nov 25, 2010
the permissions for my home directory were accidentally changed from 'access files' to 'create and delete files', and I changed them back, but ever since then I am not able to change any preferences/settings at all. power management, themes, panels, emerald, anything. my user account is supposed to be the administrator, and all the user privliges are checked. how to get control of my computer back?
View 9 Replies
View Related
Apr 9, 2011
How to write a mkdir with -p option. I am struggling for creating subfolders. the chdir() is not working and thus subdirectories can't be created.
Code:
View 1 Replies
View Related
Feb 23, 2010
$val = mkdir $directory, 755
print $val;
does't create directory but return as value '0'
[code]....
View 2 Replies
View Related
May 1, 2009
I want to make a script that will automatically change me into the directory I was in previously. I don't know if this could be added to my .bashrc or have it be a standalone script. Can I just alias last="/bin/pwd > /path/to/file"? But then I'd have to add it to the cd command somehow right?
View 4 Replies
View Related
Mar 18, 2010
I have index.html page with tables rows and cells. Within table I have:
Quote:
<table width="100%">
<tr>
<td class="form-font" width="40%" align="left">
<iframe src="create.html" width="100%" height="200" frameborder="no" scrolling="no">
[Code].....
but in index.html appears the following screeshot.jpg. create.html and index.html are both in /var/www directory. Why create.html appears in /cgi-bin directory?
View 2 Replies
View Related
Jul 22, 2010
I have a Directory of files over time the directory has become a pain to manage... Its now a few 100GBs each file has a partner .log file so id would want some logic in keeping these together..So I want a script to move the files into sub-directories with a limit or 4GB and then i'll burn each of the directories to DVD.
View 14 Replies
View Related
Jun 10, 2010
How can we fire a shell command like ls,./a.out automatically in kernel space via a kernel module ? i.e. replacement of system() function of user space into kernel space.We need to develop a kernel module which can fire some shell command let say "firefox [url]" automatically to open google automatically from module.
View 2 Replies
View Related
Jan 7, 2011
To create a daemon, you need to execute these 2 lines (among others):Code: init log
umask 0 What do each of these do?I didn't find anything on the 1st line. (The queries returned mostly "the log of the init (process)".)Google cast some light on the 2nd line: By setting the umask to 0, we will have full access to the files generated by the daemon. Even if you aren't planning on using any files, it is a good idea to set the umask here anyway, just in case you will be accessing files on the filesystem.
View 2 Replies
View Related
Apr 25, 2011
Not sure if this is the right place to ask this question. In Solaris we have umask (shell builtin) and /usr/bin/umask. However I could not find /usr/bin/umask in Linux.
I want to know the difference between both and how can we achieve the functionality of /usr/bin/umask in Linux as its not there...
View 6 Replies
View Related
Nov 23, 2010
i am trying to install symantec endpoint on a linux server by this command rpm -ivh sav-1.0.3-8.i386.rpm but it gives me the following error error: unpacking of archive failed on file /opt/Symantec/bin/navdefutil;4ceb8d6b: cpio: mkdir failed - No such file or directory
View 3 Replies
View Related
Aug 25, 2010
I have a line of code from a csh script:Code:if ( ! -e TEST ) mkdir TESTit checks if the directory "TEST" exists and if it DOES exist then nothing happens, if it DOES NOT exist then directory TEST will be made. Now I want to use this in a sh (or bash) script. Does anybody know the equivalent of the line above for sh?
View 5 Replies
View Related
May 26, 2011
I need to create a directory named just like his parent.
Example:
I tried this but because there is "Space Characters" in the name of Parent directory, my script fails.
View 8 Replies
View Related
Apr 5, 2011
I keep creating practice perl scripts in a linux directory using vi <filename> and need to chmod 751 <filename> before I can run it as I wish to. I'm sure there is a simple way to default my permissions or config them at creation, but I'm not familiar with it ayuda me por favor.
View 2 Replies
View Related
Aug 9, 2010
I set up an FTP server with two separate directories. One of them is mine, and the other one is shared (for anonymous ftp). The layout is like this.
/home/hallvor <---- this is my ftp directory where I keep my private files. I am the only user.
/home/ftp <---- this is the shared ftp directory with anonymous login.
Whenever I transfer files from my ftp directory to the public /home/ftp, I would like to: prevent anonymous users from deleting files in /home/ftp or uploading their own files to that directory (read only) What permissions must I set? I think this is all a bit confusing. I tried to chmod /home/ftp to 644 and change ownership to root, but that made it impossible to even log on anonymously.
View 8 Replies
View Related
Jul 15, 2009
I just upgraded to fedora core 11. I need to change the permission of the html folder. The owner is currently set to root. Since there is no longer a root user (I just found out) it will not let my user account change the permissions in that directory from. How do you change directory permissions in fedora 11?
View 2 Replies
View Related
Oct 26, 2010
This is on a customized Ubuntu 10.10 LiveCD. I have a directory which the default user "ubuntu" owns, and the permissions on the directory is 777. I'm unable to cd into the directory as ubuntu user. However as root user I'm able to access it. What could be the reason? I'm able to view the directory in nautilus.Note: I originally copied the folder over from an NTFS disk.
View 1 Replies
View Related
Apr 9, 2011
When Packaging my Python app using dpkg -b I find that it does not work and it comes out with
dpkg-deb: control directory has bad permissions 700 (must be >=0755 and <=0775)
I have tried chmodding the connary/DEBIAN directory as so: sudo chmod -R 755 connary/DEBIAN but it does not seem to do anything.
View 1 Replies
View Related
Jun 30, 2011
if I do ls -la on a file, it would show the permissions of the file on the left side. I would like to do the same on a directory(ls -la directory) and have only one line printed out with the directory and it's permissions. But the result is the content of the directory and not the directory itself.
View 7 Replies
View Related