Creating a file where the owner and group is not root


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Creating a file where the owner and group is not root
# 8  
Old 06-06-2012
What is the output of id ?
This User Gave Thanks to vbe For This Post:
# 9  
Old 06-06-2012
I'm not sure I understand what you mean.
# 10  
Old 06-06-2012
He means to run the id command, and see what it does. Not a trick question.
This User Gave Thanks to Corona688 For This Post:
# 11  
Old 06-06-2012
uid=1000(diltsjr) gid=1000(diltsjr) groups=1000(diltsjr), 4(adm), 24(cdrom), 27(sudo), 30(dip), 46(plugdev), 109(lpadmis),124(sambashare)
# 12  
Old 06-06-2012
When you create files as this user, it will create them as this username. If it didn't create them as this username, you didn't use this user to do so.

How exactly did you create this file? Did the script actually need to run as root? Running things as root needlessly is a big security problem.
# 13  
Old 06-06-2012
This is the code I used to extract a zip file from a server. It's working now. I'm pretty sure I just typed in sudo before executing the perl script and kept hitting the down key to re-run it without realizing it. Thanks for your help!

Code:
	#downloading .zip file
	my $barcode_sff_url = "http://server/output/Home/$name[0]/$barcode_sff";
	open (OUT, ">", $barcode_sff) or die $!;

	my $user = 'name';
	my $pass = 'pass';

	#sets up request
	my $req = GET($barcode_sff_url);
	$req->authorization_basic($user, $pass);

	#do it
	my $response = $ua->request($req);

	#check and print to file
	if ($response->is_error())
		{
			printf "%s\n", $response->status_line;
			print "http request error!\n";
		} else {

			my $content = $response->content();
			print OUT $content;
		}
	close OUT;

---------- Post updated at 02:38 PM ---------- Previous update was at 02:09 PM ----------

No, I was wrong. It still copies to root. I don't know what's going on Smilie

Last edited by Scrutinizer; 06-09-2012 at 03:00 AM.. Reason: code tags
# 14  
Old 06-06-2012
What do you mean, 'still copies to root'. What, exactly, are you doing? How are you running this program? Are you saving the files anywhere in particular? Explain exactly what you do word for word, letter for letter, keystroke for keystroke.

Nothing in that program needs to be run as root, and nothing in that program even asks for root privileges. The problem is either in the filesystem or how you use the program.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX command to display Owner,Group,Root and Subdirectories list

Hi Team, Am a newbie to Unix. As I would like to see the Server Name,Owner Name ( not numeric form), Group Name ( not numeric ID), ROOT path. I would like to send this list as an attachment to my personal mail. Can any one please help me out to to resolve this . Here is the sample result... (6 Replies)
Discussion started by: vasuvv
6 Replies

2. AIX

Files without owner and group

Dears it is normal that the below binaries stay without any owner and group I have checked it in many servers and the like the below /usr/lpp/bos.net/inst_root/etc/ipsec# ls -lrt total 248 -r-xr-xr-x 1 987 987 13589 Jun 29 2005 default_group -r-xr-xr-x ... (5 Replies)
Discussion started by: thecobra151
5 Replies

3. Emergency UNIX and Linux Support

To identify the group owner

If I have to identify the group owner of an AIX group, what is the command to be used. Example: there is an mqadm group, how do I find the owner of this group? Please help. (6 Replies)
Discussion started by: ggayathri
6 Replies

4. UNIX for Dummies Questions & Answers

Finding the group owner for a file

How would I find out who the group openers is of a file? For example: > ls -l myfile -rwxr-xr-x 1 myronp hawks 20125 Oct 20 20:50 myfile How do I return just hawks. I could do this with a series of cut or awk, but is there a more direct way. The ls -g is better, but still... (1 Reply)
Discussion started by: Dad4x
1 Replies

5. UNIX for Dummies Questions & Answers

Finding the Group Owner Name

Hi all, How can i find the group owner name...??? Thanks (4 Replies)
Discussion started by: mansahr143
4 Replies

6. Shell Programming and Scripting

Creating a control file for a group of files

Hi, We have almost 45,000 data files created by a script daily. The file names are of format-ODS.POS.<pharmacyid>.<table name>.<timestamp>.dat. There will be one data file like this for each pharmacy and each table.(Totally around 45,000) The requirement is to create a control file for each... (2 Replies)
Discussion started by: Maya_Pillai
2 Replies

7. UNIX for Dummies Questions & Answers

How to set the name of the group and the owner while creation of the file?

How to set the name of the group and the owner while creation of the file? -rwxrwxr-x 1 root sys 1202 Dec 5 2002 abc.awk like here i need to set the name of root and sys to xxx xxx Any help is appreciated. Thanks. (2 Replies)
Discussion started by: nehak
2 Replies

8. Shell Programming and Scripting

permission, owner and group

hello I search a script (ksh for Aix 5.3) to save all permissions, groups and owner for all files. Because we work much to change it, and a mystake ......! So i want execute this script to save/ execute permissions for all files. If you have this script, thank you for your help ;) best... (2 Replies)
Discussion started by: pascalbout
2 Replies

9. UNIX for Dummies Questions & Answers

Can't change owner and group of a linux file

Hi, I don't know how the owner & group of a login file in redhat linux 7.2 changed to bache like, -rwxr-xr-x 1 bache bache 17740 Jun 20 02:05 login I am trying to change the owner and group to root by using #chown root login #chgrp root login But i am getting the error ... (7 Replies)
Discussion started by: bache_gowda
7 Replies

10. UNIX for Dummies Questions & Answers

owner and group in Linux

I am bit unclear of how Linux was set in the real world, please advise me how it's supposed to be. When I log in as root and do a ls -l, I find: /boot, /, /var, /usr, /tmp, /home, /u01, /u02, /u03 and of of this partition is owned by root and the group also belong to root. Is that the way it's... (1 Reply)
Discussion started by: lapnguyen
1 Replies
Login or Register to Ask a Question