Access file ownership related questions


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Access file ownership related questions
# 1  
Old 04-06-2009
Access file ownership related questions

I have two issues; any help regarding this would be highly appreciated.

  • We deployed a file abc using pqr id. So the owner is of abc file (shell script) is ‘pqr'. However, abc file is executed by ESP event and uses the id ‘xyz'. When the file abc is executed the owner of the directory it creates is ‘pqr'. However, we want the owner to be some other id, say, ‘efg'. How can we do that? Abc file refers to a profile file and I am wondering if I can set the user id or something in the profile by which any program reading the profile would create any directory of files with the ownership defined in the profile.

  • We would like to create a user id for which will have read/write access to only one or two specific directories. How can we manipulate/update the profile of the id to achieve this?

I am stuck with these issues and any help would be greatly appreciated.

Thanks in advance for your reply.
# 2  
Old 04-07-2009
issue 1: why not modify abc script to add a chown command at the tail end of it
to modify the ownership of the created directory?

otherwise -- i believe you may be able to do something like this:

su - efg -c abc

This way the script is actually run by user efg and thus the directories it
creates are owned by efg not xyz.

issue 2:

easiest for my money:
In the .profile, create an alias for the cd command:

Code:
alias -x cd=_cd

function _cd()
{
case $1 in
  acceptable_directory) \cd acceptable_directory ;;
  other_acceptable_directory) \cd other_acceptable_directory ;;
  *) echo permission denied. ;;
esac

alias -x unalias=:
}

Make the .profile only writeable by root, readable by group and public.
# 3  
Old 04-16-2009
Thanks for your reply. Apparently there is a syntax error in the code. Here is the message I get.

.profile[39]: syntax error: `(' unexpected

Line 39 is the first statement:

function _cd()
# 4  
Old 04-16-2009
oops. a little language overlap.

Just remove the () on the function declaration line:

function _cd
{

etc....

}
# 5  
Old 04-16-2009
maybe this might work better:
This solution allows for relative paths in the cd command.
And also the use of CDPATH.

The "cd -" returns the user to the previous directory.

Code:
alias -x cd=_cd

function _cd
{

\cd $*

case $PWD in
### No operation for okay directories.
  $HOME) ;;
  /tmp) ;;
  /billcons) ;;
  *) echo permission denied.; \cd - ;;
esac

return
}

alias -x unalias=:

# 6  
Old 04-16-2009
Hi,

Thanks a lot, this works fine when someone telnet to the box. But if they use filezilla this does not work. You can browse any directory using filezilla and that's what I am trying to prevent. I don't want anyone to be able to browse any directory either via telnet or filezilla or any other means other than what is defined in the profile.
# 7  
Old 04-16-2009
yeah. filezilla.

under what login do they connect?

i believe your only hope is to make your whole system non-navigatable by world.
And make sure that the login and default group of the filezilla login can only
access the directories in question --- forgetting the shenanigans that I proposed
earlier.

Oh. and the filezilla login has to have its own unique group also.

Last edited by quirkasaurus; 04-16-2009 at 12:39 PM.. Reason: group considerations
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Questions about remote access and install USB devices.

I have a server running openindiana, it hosts virtualbox and several VMs on it. My first question is if I can run openindiana desktop from my windows on same network, now I am using XWin server under cygwin-X, I can run GUI of VirtualBox etc. but can I have the openindiana desktop show on my... (2 Replies)
Discussion started by: wyx2000
2 Replies

2. Red Hat

General questions related to patching and servers

Hi, Can you answer the following ? How to identify server is physical or virtual server ? Why often patching is done in servers ?What is the purpose of doing OS patching in servers. ? Regards, Maddy (5 Replies)
Discussion started by: Maddy123
5 Replies

3. Shell Programming and Scripting

Scripting questions, remote access

Hi, Background: There are 2 servers server1 and server2 In server1 i have my script to perform a functionality from the script in server1 i m calling a script named action in server2. The script action has to check the size of a file in a particular location in server1, if the size of the file... (1 Reply)
Discussion started by: jayii
1 Replies

4. UNIX for Dummies Questions & Answers

What is the need of ownership to a file/dir?

Hi, I understand the permissions of a file/directory. I just needs to understand how ownership works. Can some one help me on this please? Thanks in advance. (6 Replies)
Discussion started by: praveen_b744
6 Replies

5. IP Networking

dhcpd-related questions

I have two items, only related because they are both regarding dhcpd. First of all, I keep seeing dhcpd responding to DHCPREQUESTs on eth1 which is my cable modem. For example: Sep 12 21:00:09 plague dhclient: DHCPREQUEST on eth1 to 204.186.xxx.xxx port 67 Sep 12 21:00:09 plague dhcpd:... (2 Replies)
Discussion started by: NESter
2 Replies

6. Solaris

Questions related to ndd commands

Hello Gurus I would like to know more about ndd commands related to ethernet(NIC) like how to set link_status, link_speed & link_mode as I know how to check these value. And I also would like to know how to make these setting permanents after reboot as I know that these setting will vanish... (5 Replies)
Discussion started by: amity
5 Replies

7. Shell Programming and Scripting

file ownership confusion

Hello all, I have a script that runs on both the test and production box. The script is owned by a user (abcd for example) with permission set to 700. When this script is run as a root, the log file generated has owner and group as abcdowner and abcdgroup respectively. Now, when I run the same... (4 Replies)
Discussion started by: solaix14
4 Replies

8. UNIX for Advanced & Expert Users

.bash_profile access related.

1.If a user adds the logout command in the .bash_profile file, then that user cant login.(I hope I'm correct) So, is there anyway to login into that users account without contacting the root or an administrator. 2. Is there anyway to execute a command in remote machine rsh and uux seem to fail... (6 Replies)
Discussion started by: sriram_r
6 Replies

9. UNIX for Dummies Questions & Answers

few new bie questions related to gdb , telnet

Hi All, 1. how to what is the current line we are executing. List command will display the 10 lines by default. 2. how to put a pointer to the current excuting line when executing the list. 2. if i have set one break point and i want to set 2nd break point do i need to delete the first break... (1 Reply)
Discussion started by: gauri
1 Replies

10. Shell Programming and Scripting

help regarding file ownership

hi friends,i have a doubt,if there is a file for which i have only read access then is there any way to execute it,plz reply soon (5 Replies)
Discussion started by: amit007
5 Replies
Login or Register to Ask a Question