user: oracle
1, chown anywhere on system:
vi /etc/sudoers
add : oracle ALL = NOPASSWD: /bin/chown
2, chown for one directory on system:
chown from root or other user to : oracle:oinstall
directory: /backup
------------
mkdir /chownbk
touch /chownbk/chownbk.sh
vi /chownbk/chownbk.sh , add : /bin/chown -R oracle:oinstall /backup
vi /etc/sudoenrs , add into last: oracle ALL = NOPASSWD: /bin/sh /chownbk/chownbk.sh
user oracle run command: sudo /bin/sh /chownbk/chownbk.sh
No comments:
Post a Comment