Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

transferring files to /etc and /usr/local/bin via bash scr..

 
   Mac (Home) -> Mac System RSS
Next:  save emails while uninstalling trial and install ..  
Author Message
Jack Shown

External


Since: Sep 21, 2009
Posts: 2



(Msg. 1) Posted: Mon Sep 21, 2009 4:02 pm
Post subject: transferring files to /etc and /usr/local/bin via bash script on 10.5
Archived from groups: comp>sys>mac>system (more info?)

Is it possible to sftp files to remote Macs in which I have the the
admin password?

Below is a snippet from my script but it does not succeed because of
permission problems
(i.e. not being root).

admin_sftp() {
sftp admin@$1 << EOF
cd /usr/local/bin/cron
put osx_update
chmod 700 osx_update
cd /etc
put crontab
chmod 600 crontab
put hosts
chmod 644 hosts
put machinelist
chmod 644 machinelist
quit
EOF
}

The above function is called in a loop varying through a range of IP
addresses
to which I want to distribute files. However, since the files are
owned by root,
the file transfer does not succeed. No root user is enabled other
than by sudo.
Is there a way to do this right?

Thx. Jack
Back to top
Login to vote
Bob Harris

External


Since: Sep 17, 2005
Posts: 225



(Msg. 2) Posted: Mon Sep 21, 2009 9:25 pm
Post subject: Re: transferring files to /etc and /usr/local/bin via bash script on 10.5 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
<149879d8-2963-488b-9c99-17eead72db8e.RemoveThis@v15g2000prn.googlegroups.com
>,
Jack Shown <jackshown.RemoveThis@gmail.com> wrote:

> Is it possible to sftp files to remote Macs in which I have the the
> admin password?
>
> Below is a snippet from my script but it does not succeed because of
> permission problems
> (i.e. not being root).
>
> admin_sftp() {
> sftp admin@$1 << EOF
> cd /usr/local/bin/cron
> put osx_update
> chmod 700 osx_update
> cd /etc
> put crontab
> chmod 600 crontab
> put hosts
> chmod 644 hosts
> put machinelist
> chmod 644 machinelist
> quit
> EOF
> }
>
> The above function is called in a loop varying through a range of IP
> addresses
> to which I want to distribute files. However, since the files are
> owned by root,
> the file transfer does not succeed. No root user is enabled other
> than by sudo.
> Is there a way to do this right?
>
> Thx. Jack

The files in question are owned or controlled by 'root', and until
the admin does an 'sudo' the admin is working in 'mortal' mode.

You could give the 'root' account a password, which would then
enable 'root' login

sudo passwd root
password: your admin password here
Changing password for root.
New password:
Retype new password:

-OR- Instead of enabling the root account, you could instead,
create an ssh key and put that in the root's authorized_keys file

ssh-keygen
copy the $HOME/.ssh/*.pub file to the other system.
Store the .pub file in the root account's
.ssh/authorized_keys file
Then you should not need to know the root account's password.

Now you can use sftp or even better scp to copy files into
directories owned by 'root'

chmod 700 osx_update
scp -p osx_update root@$1:/usr/local/bin/cron/osx_update
chmod 600 crontab
chmod 644 hosts machinelist
scp -p crontab hosts machinelist root@$1:/etc/crontab

Bob Harris
Back to top
Login to vote
Warren Oates

External


Since: Nov 27, 2005
Posts: 465



(Msg. 3) Posted: Tue Sep 22, 2009 7:58 am
Post subject: Re: transferring files to /etc and /usr/local/bin via bash script on 10.5 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <nospam.News.Bob-F67ED6.20180421092009 DeleteThis @news.verizon.net>,
Bob Harris <nospam.News.Bob DeleteThis @remove.Smith-Harris.us> wrote:

> -OR- Instead of enabling the root account, you could instead,
> create an ssh key and put that in the root's authorized_keys file
>
> ssh-keygen
> copy the $HOME/.ssh/*.pub file to the other system.
> Store the .pub file in the root account's
> .ssh/authorized_keys file
> Then you should not need to know the root account's password.
>
> Now you can use sftp or even better scp to copy files into
> directories owned by 'root'

This is quite interesting too:

http://www.bombich.com/mactips/rsync.html
--
Suddenly he realized that he was alone
with a giant halfwit on a dark deserted street.
-- Chester Himes
Back to top
Login to vote
mike

External


Since: Sep 22, 2009
Posts: 1



(Msg. 4) Posted: Tue Sep 22, 2009 9:25 am
Post subject: Re: transferring files to /etc and /usr/local/bin via bash script on 10.5 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2009-09-22 02:18:08 +0200, Bob Harris
<nospam.News.Bob DeleteThis @remove.Smith-Harris.us> said:

> ssh-keygen
> copy the $HOME/.ssh/*.pub file to the other system.
> Store the .pub file in the root account's
> .ssh/authorized_keys file
> Then you should not need to know the root account's password.
>
> Now you can use sftp or even better scp to copy files into
> directories owned by 'root'

you might also need to switch "PermitRootLogin" to "yes" in
/etc/ssh/sshd_config
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Further Help transferring WXP files Mac OS X - The following is a good summary - if you're directly connecting the Mac and PC with a crossover cable. If you're using a (reasonably modern) router, (a) no crossover cable and (b) the router's DHCP server will handle the IP addresses and Subnet masks ...

Transferring files from windows xp to mac os x with an eth.. - i recently posted a message about transferring files from my windows xp machine to my mac os x. someone suggested that i use a ethernet cable to connect the two machines. i went ahead and plugged them in, but couldn't figure out how to have the..

Trouble transferring files from old imac to intel imac? - So after holding off on buying a new imac for over 5 years I decide to pick one up. My previous imac is a 2002 indigo. I restarted the intel imac in target disc mode. The intel imac's hd didn't post to the old desktop. Instead the older imac gives me a..

bash shell - I have a questions about the bash shell. I created a .bash_profile to set up the path. I added some personal directories to the path and when I open the terminal the path is now set as I want it. I just wonder if application that are not run from the..

Help: "/bin/bash: Permission Denied" - Hi, Could someone help me quickly. I was changing some file access rigths in /Users as root when suddenly it become impossible to log in as any of the users except root. I can log in as root by SSH and then when I do: su myusername I get su:..
       Mac (Home) -> Mac System All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact