Software :: Script For Checking Ownership / Permissions Of Directory
Oct 14, 2009
I am writing a script that is checking the ownership and permissions of a directory. If the directory in question does not have the correct ownership and permissions, the script will run the appropriate commands to give it the correct settings. The if...then...else syntax. The idea here is the following:
Code:
If <directory> no eq = <ownership root:root> && <permissions 755>
then chown root:root <directory> && chmod 755 <directory>
else exit
fi
What would the correct syntax be for the If line of the loop in question?
View 8 Replies
ADVERTISEMENT
Jan 1, 2011
I installed Ubuntu from the alternate cd a few days ago to save space and resources on a very old laptop. (install command line, then add what I wanted) But I have struck an interesting problem with file permissions. Various programs like synaptic, leafpad, pcman, Banshee, all require I enter the root password to execute them (or sudo command from terminal). I want to change synaptic from root ownership to sudo and leafpad etc to execute without using the sudo command in terminal. I could get comments on the commands before I execute them in terminal and if I am introducing a security problem, as I am still learning bash. $ sudo chown sudo:sudo synaptic
I would still be asked for my sudo password before being able to open synaptic? As in standard Ubuntu instead of root password.$ sudo chmod 777 leafpad pcman Banshee All users could open these programs from the menu? I have my admin account and a general account which I use for everyday things like surfing the net and listening to music.
View 6 Replies
View Related
Sep 15, 2010
Is it possible to let users create the directory or files but only user "yat" can delete them.suppose other users are geller ross joe from group FH , who have privileges. whenever these users create file or dir , they should not able delete it.BottomLine: Group users should create file but should not be able to delete them.By the way using sgid bit didnt help .
View 14 Replies
View Related
Jan 16, 2010
just trying to learn linux here and have some comfusing moments.it is my understanding that if you own directories and files you maychange the group, ownership, and permissions on all of these as you desire.however, in my case I cannot make any changes in my setup on group, ownershipor permissions on any of my files or directories.get error message <operation not permitted>. I know as root you ar supposed tobe able to do anything you desire, however in my case I can go in as root andtry the same commands with the same results. it is as if I am locked out ofsystem as far as any changes are concerned.on my jump drive I have:
total 83832
drwxr-xr-x 26 jevans root 16384 1969-12-31 19:00 .
drwxrwxr-x 9 jevans jevans 4096 2010-01-15 12:51 ..
[code]...
View 14 Replies
View Related
Jan 18, 2010
After burning files to DVD+RW, the owner is changed to root, and all permissions are read only. I want to periodically open these files, update them, and save to the DVD again, but I no longer have permission and cannot change the permissions since I am no longer the owner. I tried sudo commands, but get responses "Read only file system". I have erased and reformatted the DVD and started over but get the same results.
I have Ubuntu 9.04, and have tried Brasero and Nautilus and get the same problem. Am I using the wrong kind of DVD/CD?
View 3 Replies
View Related
Aug 30, 2010
I have been VERY lucky and managed to restore from a formatted ext3 /home/ partition. I used testdisk to reset the original partition which had had nothing done to it since formatting(!). However some of the file permissions are a altered and I cannot change them. I have tried "su chmod" and even temporarily enabled the root account itself and tried to alter the ownership/permissions from root 'proper' without it helping.
Here is an example of the output of ls -l
drwxr-xr-x 2 martyn martyn 4096 (date) (time) sponsors
?-----S--T 63231 92820383 44090688 4286824785 (date) (time) order.xls
The first line looks like a normally formed output and indeed is readable. The second line looks corrupted and I don't have a clue how I can reclaim this - or even if it is possible. Should I count my blessings most of my files are intact and leave those be?
View 2 Replies
View Related
Apr 19, 2011
I finally replaced my Windows with Linux.. However, I need to run applications and modify files that are on NTFS mounts. I am unable to change ownership, permissions, and groups on these files so I may modify them without having to copy. I have several times attempted to chmod, chgrp, chown, etc.. while logged-in as root user; however it is to no avail. The owner and permissions are still geared towards root. can I change ownership and permissions on NTFS files so I can modify them without having to convert/copy them over to ext4 or different file system?- Matbtw: I am using OpenSuse 11.4 and running Windows apps with VirtualBox (with Vista installation image). I still have Win7 on my computer (non-emulated) and I would like to keep some files on those NTFS partitions so when I occasionally need to boot into Win7 I can modify those files because Windows blows and doesn't support Linux.
View 5 Replies
View Related
Jun 4, 2011
I use Linux but have a computer with windows I use for gaming. It died and put the hard drive into another computer and used knoppix to recover my files. I looked at the ownership of the windows files and the owner is knoppix. Now I am concerned that ownership will not work on my new Windows computer (when I finish building it, that is). Since I don't get into Windows much I have no idea what those permissions should be.
If I copy them with owner knoppix can I even access them in Windows to change the ownership to whatever Windows will accept? If I change the ownership before putting them on a CD with knoppix, can I write the CD? I will have to use the hard drive on the new windows box so will not have access to the files later (unless I also copy them to my Linux computer for safekeeping). At least I know the ownership changes to make with Linux.
View 2 Replies
View Related
Aug 9, 2009
My system (CentOs5.3) became erratic after i tried to change wholesale the ownership of the /FS. is it possible to change ownership or rwx permissions of files in linux? what is the safeguard available to preserve the consistency of the program files in linux against such an attempt by su?
View 2 Replies
View Related
Aug 1, 2010
I run the servers hosting an intranet, a couple of services and an external websites for my club at university. I'd like to back up all the config files to some version control system to keep track of changes, in case one of my colleagues breaks something. The idea is to keep snapshots and then just roll back the required file in case something happens.
Now to the main issue: How does a version control system handle file permissions and ownership? Does it keep them? Does it set the permissions of the user who committed the last change? These are important questions as we have multiple daemons with different users...
View 2 Replies
View Related
Jan 16, 2010
I caught my two oldest boys at various times playing games instead of doing their school work.I said enough is enough. I will lock them out of the games. I don't think you need to be in the games group to play games
View 7 Replies
View Related
Feb 12, 2011
Being new to Linux, i've just about got used to the Debian setup procedure now, but had a quick question on the default ownership of files and folders. On my default Debian installation, almost all the folders and files are owned by root:root. Is this the correct advised configuration or should the folders and files be owned by a user without root permissions - eg user:user?
View 12 Replies
View Related
Oct 9, 2010
I have my hard drive arranged with a single large ntfs data partition and a number of smaller partitions for /home etc. Here's the line in fstab:
Code:
/dev/disk/by-id/ata-SAMSUNG_HD103SJ_S246J9FZ806954-part2 /home/shmuck/data ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
But the ownership for that directory is root and I can't change it for some reason, using this line:
Code:
sudo chown -R shmuck /home/shmuck/data
It just doesn't do anything.
View 7 Replies
View Related
Jul 2, 2010
Installed Sidux over LennySidux didn't want to take my usual username, because a folder with that name existed in my home directory.So, I just mounted the home partition and changed the name of my home directory from shay to shay1.Don't know what that did or didn't do permission wise to the files in my old home directory, but I've got a few unowned files floating around my home directory anyway that have been dragged in from old harddrives and such.
View 3 Replies
View Related
Jun 24, 2011
I've already done the following commands
Code:
su
chown theif519 /home/theif519
chmod 775 /home/theif519
exit
#usermod -d /home/theif519 login
I've logged out and logged back in, and I was successful in making it the default directory it logs in to. Still, afterwards I noticed that that when I use the list all commands "ls -l" it shows that root owns it and it also shows that I do not, by default, have read write execute over it, only read execute. I'm using Slackware 13.37* in a Virtual Machine* Another thing, I don't think I added any rights to my user, how do I give it more rights as well? Like, wheel and sudo and all of that stuff. Also, this was the website I was using *Although it didn't help much, the comments sure did [URL].
View 4 Replies
View Related
Oct 1, 2010
I want to change the the user and group of user kumata as kumara,but not getting change by using the below command. #chown -R kumara:kumara kumara
Getting using doesn't exist.
For reference find the below output.
[root@xyz ~]# /usr/bin/getent passwd | grep mathurr
mathurr:x:12271:12271:Mathur, Rajat X:/home/mathurr:/bin/bash
[root@xyz ~]# /usr/bin/getent passwd | grep kumara
kumara:x:12102:12102:Kumar, Abhishek X:/home/kumara:/bin/bash
[Code].....
View 10 Replies
View Related
Jan 14, 2010
I'm working on my first bash script. My script will do several things but right now I'm just trying to get the basic part of it down and working.I have a section that looks like this
Quote:
#/!bin/bash
SERVER=$1
if [ ! -d `ssh ${1} /somedir`];then
echo "Bad"
[code]...
The problem is that if you take that right now and run it, it will return back good in that it does exist. What I need it to do is pass back that it's bad because it doesn't exist (that is unless you actually do have that directory in your root).
View 1 Replies
View Related
Jun 6, 2010
I want to create a file in the /root directory and then make sure it exists. The following code keeps telling me that the file doesn't exist even though it does.
Code:
#!/bin/bash
echo -e "username=someusername
passwordsomepassword" | sudo tee /root/.credentials
if [ -e /root/.credentials ]; then
echo "File exists!"
[Code]...
[Edit] Added second double quotation mark at the end of "somepassword"
View 5 Replies
View Related
Jan 22, 2011
I followed this doc for the "debian method" for building the kernel: [URL]. I installed the source in /var/tmp/src/linux-2.6-2.6.32 , configured it, and tried make-kpkg modules-image. The error I get is:
checking for current directory... /usr/src/modules/alsa-driver
checking cross compile...
checking for directory with ALSA kernel sources... ../alsa-kmirror
checking for directory with kernel top-level makefile... /var/tmp/src/linux-2.6-2.6.32
checking for directory with kernel headers... failed
make[2]: *** [configure-stamp] Error 1
make[2]: Leaving directory `/usr/src/modules/alsa-driver'
make[1]: *** [kdist_image] Error 2
make[1]: Leaving directory `/usr/src/modules/alsa-driver'
Module /usr/src/modules/alsa-driver failed.
I tried some hacks such as setting KBUILD_SRC or ln -s linux-headers-2.6.32-5-amd64/ /usr/src/linux - but these fail too.
View 2 Replies
View Related
Nov 19, 2010
i was not able to install alsa...showing the error checking for directory with kernel source... Please install the package with full kernel sources for your distribution or use --with-kernel=dir option to specify another directory with kernel sources (default is /lib/modules/2.6.18-194.el5xen/source). my friends installed the alsa for cent os 5.4...how to rectify this...
View 3 Replies
View Related
May 10, 2010
Sometimes at startup I get this message "Checking disk 1 of 1". Does that mean it's checking all partitions on the hd? After a bad shutdown there is no prompt for fsck to run and the system just boots up. In fstab I have both options set to "1" for the partition Ubuntu is on, all others set to "0". Any ideas on both?
View 3 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
Oct 20, 2009
I am confused that what should be the permssions of home directory because currenlty my users when they log into their home directory , they can see all the contents of /home directory as well..However if i take read all permissions then my sites are not accessible , what should i do The current permissions are 755
View 4 Replies
View Related
Jun 30, 2011
I'm trying to create a script that when given a diretory, it goes traverses through all the subdirectories and process the files in them.However, there is one restriction.directories thatit traverses through must all have a read permission for the others group.How would I go about doing this?
View 1 Replies
View Related
May 27, 2011
I'm setting up an automatic mount point on one of my servers. However, for this file I only want certain people (permissions) to access it once it is mounted. I'm figuring I need to place this either on an ACL (via setfacl) or by configuring this in my mount point config file (auto.misc) . Has anyone done this before, restrict use of an auto mounted directory?
[Code]...
View 3 Replies
View Related
May 6, 2009
My boss has commissioned me with creating a new file server to replace a M$ server that is installed now. We want to go with Linux for many reasons, but one big thing we want to be able to do is still manage permissions using M$ type permissions from our XP desktop's rather than unix style permissions. How would this be accomplished on a CentOS box?
View 1 Replies
View Related