General :: Renaming External Files Changing Ownership Instead Of Root
Mar 28, 2011
i have inherited a mixed bag of sorts: several xp users updating an access mdb with the BE on a lamp stack shared via samba. i have a backup device which gets mounted at: /media/disk... each client record (has) a folder by the companyname on the samba share, and all relative documents are placed there. when the backup script runs, it just copies newer or missing files.
someone has been renaming folders, and not matching the folder name to the related companyname from the mdb. so...the backup script captures and duplicates the data in the renamed folders. some client records also have periods in the name (not required from a data pov), such as 'Company Ltd.' instead of 'Company Ltd'. i can produce a list of company names as the folders should be found easily enough, but get a little stuck with the linux scripting.
i can easily remove and further prevent any unwanted punctuation in the company name on the client record, and create the correct folder name on the samba share with vba, but would also like to:
-for each 'client activity' folder on the backup device
-rename the folder by removing punctuation marks
or
-delete the folder if is a dupe
i tried: ls -al | grep '&' - it properly returns only those lines with an ampersand in the folder name, but returns all folders when i try that with a '.'.
what would be the easiest method to do the renaming? i thought if there was a way to change ownership of the mounted device, then the vba code (easy to write) would be simple.
OK - i just ran chown -R on the external device, changing ownership to (me) instead of root. didn't want to because it took too long, but can now use the MoveFolder method of the filesystemobject from my app to do the renaming instead of some sort of bash script (which i was dreading).
I have an external usb hard drive, vfat, mounted as /media/USB STORAGE. It has on it's own(?) changed it's ownership to root. I need to change it back. I have tried 'sudo chown -R pbhill : pbhill /media/USB STORAGE' and get the message that no such file or directory exists. I can access it read only, so I know it exists. Am I using the correct command?
I just got a 1.5 terrabyte Western Digital My Book 1110 external usb 2 drive. I used Gparted to reformat the drive to ext3. The problem I have is I can't change the file permissions for the drive because it says the drive is owned by root. I can't back up my files into the drive because it won't allow me to. I am using Jaunty Jackalope and got this drive to back up my files so I can feel comfortable in upgrading to Karmic Koala in case there are major problems with the upgrade.
I know someone out there in the community can tell me the commands to use in the terminal to let me gain ownership of this external drive from root so I can copy my files into it. the entire drive itself is seen as /dev/sdb One meg of the drive is unallocated and the part of the drive that I reformated is seen as /dev/sdb1 my personal files are owned by the name of dave
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?
I`ve been given a project to design a program that will interface with a hardware device through the parallel port.And so far it`s not going go. I managed to write the programe an compiled it, but when runing it the compiler says: 'changing ownership of'and then the file name then it continues to say, 'operation not permitted'.
Why would I need to be root to change the ownership of a file? Example: I'm logged in as dwadmin and I've created a file:
-rw-rw---- 1 dwadmin dgw 0 Jun 17 07:46 testing.txt
I want to change the ownership to another user, but am getting the following error: chown 511 testing.txt chown: changing ownership of `testing.txt': Operation not permitted
I am running a shell script as the user "redhatuser01" and this script creates a files in the home directory of another user "redhatuser02" (/home/redhatuser02/sample.txt) but the ownership of this file is currently "redhatuser01". How can i change the "ownership of this file to the user "redhatuser02"? (My constraint is that I cannot sudo as redhatuser2 and create the file).
Is there any working commandline alternative to # find /some/dir -group xxx -user yyy | chown xxxxx:yyyyyThe main purpose is to replace ownership and goup of certain files in subdirectories. Or nevertheless I need to write shell script for that simple operation ?
What's the command for renaming files? I thought it was "mv"--I typed "info" and read
Quote:
* mv: (coreutils)mv invocation. Rename files. So, desiring to give a .JPG extension to a jpeg file that had no extension (because I dug it out of my Firefox cache), I typed
(Ubuntu 10.04) I would like to change to change the ownership of one of my storage partitions from root to dad - I am currently reading through as much Ubuntu documentation as I can but the process is slow. If I gksudo nautilus and select the drive, right click/properties/Permissions the owner is set to root. If I try to change the group ownership from root to dad it looks like it momentarily does it but it stays at root.
using Pysdm as a gui for fstab - but so far I have only found out how to allow other users to mount the volume not own it. My fstab entry for this volume reads as /dev/sdb6 /media/backuphd2 ntfs-3g group=dad,users,user,owner 0 0 - it looks to me that in terms of ownership, root = 0 0 Can I find out what the ownership of dad is in terms of numbers (e.g. owner 0 1 or owner 1 1) and then change the fstab entry?
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.
I run a script which generated about 10k files in a directory. I just discovered that there is a bug in the script which causes some filenames to have a carriage return (presumably a '' character).
I want to run a sed command to remove the carriage return from the filenames.
Anyone knows which params to pass to sed to clean up the filenames in the manner described?
I am running on Linux (Ubuntu)
The character causing the filename to 'break up' accross multiple lines appear to be a CR (carriage return) instead of ' '. The filename is being diaplayed in thetitle of a text editor with %0D in the positions of where the file name breaks up. So I need to remove the CR chars from my filenames.
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:
I have files whose names look like this:Sim1-2_40.36.chr20_sb.foo.indel.novoalign.samSim1-2_40.36.chr20_sb.foo.indel.bwa.samWhat I want to do is to replace all indel with snp in the namesyieldingSim1-2_40.36.chr20_sb.foo.snp.novoalign.samSim1-2_40.36.chr20_sb.foo.snp.bwa.samBut why this unix command doesn't work
Recently I installed Dropbox on a server to do file synchronization and it added " (Case Conflict 1)" to a whole bunch of my files! I realize now that it was caused by case insensitivity but I'm still left with hundreds of files that are in this renamed state. Is there a script in Linux that would allow me to recursively go through the directories and strip out this string?
i.e. a (Case Conflict 1).jpg --> a.jpg /myfolder/abc (Case Conflict 1).doc --> /myfolder/abc.doc /myfolder/subfolder/mydoc (Case Conflict 1).pdf --> /myfolder/subfolder/mydoc.pdf
Basically I need to rename a bunch of .doc files using the for-structure and the mv command (w/ wildcards) in bash. I guess this would be a bit easier if I'd use the rename command, but since this is a school assignment of sorts I need to use for & mv. The .doc files are named "1filename.doc", "2filename.doc" etc. And I've got to rename them to "aaa_1filename.doc", "aaa_2filename.doc", "aaa_3filename.doc" and so on. Tried to dabble quite a bit with the for and mv commands, basically just got a bunch of errors. Every damn time. For 2 hours. The most common error was "mv: missing destination file operand after ..."
I have some random files in a folder. I want to rename all of the files in a batch process. I have a text file that contains the Currentname of all the files in the folder, as well as a text file with all of the Newname of files in the folder. I want to replace Currentnames with Newnames.
For example, here are the names of the files in the folder: 1.mp4 2.mp4 3.mp4
I have a text file with the Currentname of all the files in the folder: 1.mp4 2.mp4 3.mp4
I have a text file with the proper Newname of the file: a.mp4 b.mp4 c.mp4
I want to rename Currentname with Newname in the folder. So when I go to the folder the Newname of the files are: a.mp4 b.mp4 c.mp4
Today i am trying to learn how to use sed. I set up a testing folder with the following files:
AAb.lol AAc.lol AAx.lol test.sh
My goal is to create a script (test.sh) which renames all the files to their original name without AA. I want to end up with this:
b.lol c.lol x.lol test.sh
sed seemed to be the perfect tool so i went ahead and created a script which i think should clear the job.
[Code].........
mv: missing destination file operand after `$i' From that 2nd line i can tell that $NewName is just empty. I also read something about sed needing the -e option for scripting purposes but i just don't understand it.
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?
I have Slackware 12.2 installed on my computer, as well as a Windows Xp. I have a hard drive named '/fat-d', which is formatted to be 'fat' and is normally used under XP. This drive can also be accessed under Slackware, both as root and the normal user.I can not write to the directory '/fat-d' when I am not root, it is normal since 'ls -l' shows that its owner is root and other users have no permission to write. The problem is that, when I tried (as root) to change the owner to the normal user:# chown [normal_user_name] /fat-dI got an error: chown: changing ownership of '/fat-d/':Operation not permittedBut how can the root have no permission to change the owner?
how I managed this, but somehow during a reinstall I changed the ownership of all my home stuff to root, instead of my normal username. So now nothing loads, unless I sudo it. I had to use sudo just to open firefox.
It's pid is increasing all the time... I'm writing a program to display all the process's info, this process really bother me. Oh..the Chinese words are sleeping..., can't use, can't use