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:

PorshaCoghlan梁子珠 said...

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

韋于倫成 said...

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

D415_evonN_Risinger0 said...

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

雅馨 said...

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

雅玲 said...

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

偉倫 said...

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

丞虹 said...

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

淑賴ul貞俊李trt賢 said...

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

JasonBirk佳琪 said...

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

佳皓佳皓 said...

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

蕭惟秀蕭惟秀 said...

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

錢靜怡錢靜怡錢靜怡 said...

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

茂慧茂慧 said...

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

江桂宸江桂宸 said...

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

楊儀卉 said...

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

琬安琬安 said...

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

RicoLisi0802志竹 said...

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

毛彥宇毛彥宇 said...

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

吳林怡廷佳宇 said...

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

燕明中延 said...

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

王辛江淑萍康 said...

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

x于珊姚于珊姚于珊 said...

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

吟美岑美岑美岑樂 said...

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

翊翊翊翊張瑜翊翊翊 said...

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

至馬馬馬馬玄馬馬馬馬 said...

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

瑰潼 said...

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

冰微 said...

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