Wednesday, April 21, 2010

PHP script for SSH access

Today when I was struggling of slowly FTPing a PHP web application (Magento), which the FTP client estimates will take up to 4 hours for that 50+M of files, I start wondering if there is other way to FTP the package to server then unpack it there, not only for dev team, but also for customers. But we have only FTP access to the server, no SSH available, not if I login directly with root certification. After some discuss with colleagues, we can up of an idea of writing PHP code using the exec command to execute the unpack command. This sounds too simple and dangers, and what's worse, it works in our servers. Then I took a little additional effort to wrap up a relatively nicer PHP page to pretend SSH access from browser.

The code is here.

It is easy to see how dangers this could be in shared web hosting. It is even worse when the php is executed as the same user, like 'apache', because that means a client could get full access to others files, and can screw big things up.

27 comments:

Anonymous said...

It's great!!..........................................

Anonymous said...

很棒的分享~祝福你........................................

Anonymous said...

A truly happy person is one who can enjoy the scenery on a detour. ....................................................

Anonymous said...

好棒的地方 我一定要常來~~~^^~. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Anonymous said...

死亡是悲哀的,但活得不快樂更悲哀。.................................................................                           

Anonymous said...

知識可以傳授,智慧卻不行。每個人必須成為他自己。......................................................................

Anonymous said...

當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................

Anonymous said...

認清問題就等於已經解決了一半的問題。.................................................................

Anonymous said...

在你一無所有的時候 是誰在陪伴你 他便是你最重要的人............................................................

Anonymous said...

開心不開心都是一天,祝您能夠笑著面對一切!............................................................

Anonymous said...

來幫你衝一下人氣,幫你推推推..................................................................

Anonymous said...

good, excellent, nice job!!............................................................

Anonymous said...

來替你打氣,加油A_A............................................................

Anonymous said...

我的老天爺~內容真是太棒了..................................................................

Anonymous said...

不論做什麼事,相信自己,別讓別人的一句話,把你擊倒。..................................................

Anonymous said...

i trust everything will be fine. bless you!............................................................

Anonymous said...

愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。......................................................................

Anonymous said...

.有價值的東西,都要付出代價。-................................................

Anonymous said...

Lets cross the bridge when we come to it............................................................

Anonymous said...

百發百中不是一試就成的。..................................................

王辛江淑萍康 said...

幸福不是一切,人還有責任。............................................................

Anonymous said...

雖天地之大,萬物之多,而惟吾蜩翼之知。..................................................

Anonymous said...

文章雖然普通,但意義卻很大~~^^~~ ..................................................

Anonymous said...

「仁慈」二個字,就能讓冬天三個月都溫暖。..................................................

Anonymous said...

財富並非永遠的朋友,但朋友卻是永遠的財富。......................................................................

Anonymous said...

It is never too late to learn.......................................................................

Anonymous said...

唯有穿鞋的人,才知道鞋的哪一處擠腳......................................................................