Warning running commands out of an other users home directory is ill advised and should be avoided at all costs. By changing the users home directory permissions you may cause problems as a side effect. For example if the user logs in via ssh and uses a key for authentication it may fail due to the home directory permissions being insure which is a very common side effect of doing this kind of change.
On Fri, Sep 27, 2013 at 2:13 AM, Mahmood Naderan <nt_mahm...@yahoo.com> wrote: > >> Sorry, I just saw the mistake, I forgot to mention that you need to >> grant access to the your home directory as mentioned by Mark. >> >> chmod o+rx /home/mahmood (I added read as the user didn't have >> permission to access the directory. > >>If the filename is known (no requirement to do a ls on the directory), then >> execute is sufficient. If you give read, then all the >filenames in your >> directory are revealed (but not necessarily the contents). > > Yes, thank you. It is now solved and the execute permission was good tip > > > Regards, > Mahmood > > ________________________________ > From: John Lauro <john.la...@covenanteyes.com> > To: Earl Ramirez <earlarami...@gmail.com> > Cc: scientific-linux-users@fnal.gov; Mahmood Naderan <nt_mahm...@yahoo.com> > Sent: Friday, September 27, 2013 12:30 AM > > Subject: Re: How a user can execute a file from anothe user > > One minor note, > > Read isn't needed on the directories if the user/script/etc knows the path. > If the filename is known (no requirement to do a ls on the directory), then > execute is sufficient. If you give read, then all the filenames in your > directory are revealed (but not necessarily the contents). > > ----- Original Message ----- >> From: "Earl Ramirez" <earlarami...@gmail.com> >> To: "Mahmood Naderan" <nt_mahm...@yahoo.com> >> Cc: scientific-linux-users@fnal.gov >> Sent: Thursday, September 26, 2013 4:43:31 PM >> Subject: Re: How a user can execute a file from anothe user >> > ... >> Sorry, I just saw the mistake, I forgot to mention that you need to >> grant access to the your home directory as mentioned by Mark. >> >> chmod o+rx /home/mahmood (I added read as the user didn't have >> permission to access the directory. >> >> You should now be able to execute the script as another user. >> >> For your reference: >> >> I created a folder named "shared" in user2 home directory >> >> @lab19 ~]# ls -la /home/user2 >> total 40 >> drwx---r-x. 5 user2 user2 4096 Sep 26 15:57 . >> drwxr-xr-x. 5 root root 4096 Sep 26 15:53 .. >> -rw-------. 1 user2 user2 1387 Sep 26 16:27 .bash_history >> -rw-r-----. 1 user2 user2 18 Feb 21 2013 .bash_logout >> -rw-r-----. 1 user2 user2 176 Feb 21 2013 .bash_profile >> -rw-r-----. 1 user2 user2 124 Feb 21 2013 .bashrc >> drwxr-x---. 2 user2 user2 4096 Nov 11 2010 .gnome2 >> drwxr-x---. 4 user2 user2 4096 Dec 20 2012 .mozilla >> drwxrws---. 2 user2 public 4096 Sep 26 15:57 shared >> -rw-------. 1 user2 user2 641 Sep 26 15:57 .viminfo >> >> Created the script and was able to execute it from the user name >> user1 >> >> @lab19 ~]# ls -la /home/user2/shared/ >> total 12 >> drwxrws---. 2 user2 public 4096 Sep 26 15:57 . >> drwx---r-x. 5 user2 user2 4096 Sep 26 15:57 .. >> -rwxrwx---. 1 user2 public 18 Sep 26 15:57 script1 >> >> user1@lab19 ~]$ /home/user2/shared/script1 >> Filesystem Size Used Avail Use% Mounted on >> /dev/mapper/vg_lab11-lv_root >> 5.5G 2.8G 2.5G 54% / >> tmpfs 504M 232K 504M 1% /dev/shm >> /dev/vda1 485M 92M 369M 20% /boot >> /dev/md127 2.0G 100M 1.9G 5% /home/labs >> >> >> >> >> -- >> >> >> Kind Regards >> Earl Ramirez >> GPG Key: http://trinipino.com/PublicKey.asc >> > >