yum install autoconf cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so ./configure --with-apxs2=/usr/sbin/apxs --with-mysql make make test make install cp php.ini-recommended /usr/local/lib/php.ini
ln -s /usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1 /usr/lib/oracle/12.1/client64/lib/libclntsh.so tar zxvf oci8-2.0.8.tgz cd oci8-2.0.8 phpize ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/12.1/client64/lib make make install
cd ~/Downloads/php-5.2.17/ext/mysqli/ phpize ./configure --prefix=/usr/local/mysqli --with-php-config=/usr/local/bin/php-config --with-mysqli=/usr/bin/mysql_config make make install vim /usr/local/lib/php.ini (extension=mysqli.so)
If you've ever gotten a phone call from an annoyed user whose
transaction just won't go through, or from a developer who can't
understand why her application sessions are blocking each other, you
know how useful it can be to identify not just whose lock is doing the
blocking, but what object is locked. Even better, you can identify the
exact row that a session is waiting to lock.
To begin, create a situation where one user is actively blocking
another. Open two sessions. Issue the following commands in Session 1
to build the test table:
SQL> create table tstlock (foo varchar2(1), bar varchar2(1));
Table created.
SQL> insert into tstlock values (1,'a');
1 row created.
SQL> insert into tstlock values (2, 'b');
1 row created.
SQL> select * from tstlock ;
FOO BAR
--- ---
1 a
2 b
2 rows selected.
SQL> commit ;
Commit complete.
Now grab a lock on the whole table, still in Session 1: SQL> select * from tstlock for update ;
And in Session 2, try to update a row:
SQL> update tstlock set bar=
2 'a' where bar='a' ;
This statement will hang, blocked by the lock that Session 1 is holding on the entire table.
Oracle provides a view, DBA_BLOCKERS, which lists the SIDs of all
blocking sessions. But this view is often, in my experience, a good bit
slower than simply querying V$LOCK, and it doesn't offer any
information beyond the SIDs of any sessions that are blocking other
sessions. The V$LOCK view is faster to query, makes it easy to identify
the blocking session, and has a lot more information.
Note the BLOCK column. If a session holds a lock that's blocking
another session, BLOCK=1. Further, you can tell which session is being
blocked by comparing the values in ID1 and ID2. The blocked session
will have the same values in ID1 and ID2 as the blocking session, and,
since it is requesting a lock it's unable to get, it will have REQUEST
> 0.
In the query above, we can see that SID 422 is blocking SID 479.
SID 422 corresponds to Session 1 in our example, and SID 479 is our
blocked Session 2.
To avoid having to stare at the table and cross-compare ID1's and ID2's, put this in a query:
SQL> select l1.sid, ' IS BLOCKING ', l2.sid
2 from v$lock l1, v$lock l2
3 where l1.block =1 and l2.request > 0
4 and l1.id1=l2.id1
5 and l1.id2=l2.id2
SQL> /
SID 'ISBLOCKING' SID
---------- ------------- ----------
422 IS BLOCKING 479
1 row selected.
Even better, if we throw a little v$session into the mix, the results are highly readable:
SQL> select s1.username || '@' || s1.machine
2 || ' ( SID=' || s1.sid || ' ) is blocking '
3 || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
4 from v$lock l1, v$session s1, v$lock l2, v$session s2
5 where s1.sid=l1.sid and s2.sid=l2.sid
6 and l1.BLOCK=1 and l2.request > 0
7 and l1.id1 = l2.id1
8 and l2.id2 = l2.id2 ;
BLOCKING_STATUS
----------------------------------------------------------------------------------------------------
BULKLOAD@yttrium ( SID=422 ) is blocking BULKLOAD@yttrium ( SID=479 )
1 row selected.
There's still more information in the v$lock table, but in order to
read that information, we need to understand a bit more about lock types
and the cryptically-named ID1 and ID2 columns.
In this case, we already know that the blocking lock is an exclusive
DML lock, since we're the ones who issued the locking statement. But
most of the time, you won't be so lucky. Fortunately, you can read this
information from the v$lock table with little effort.
The first place to look is the TYPE column. There are dozens of lock
types, but the vast majority are system types. System locks are
normally only held for a very brief amount of time, and it's not
generally helpful to try to tune your library cache, undo logs, etc. by
looking in v$lock! (See the V$LOCK chapter in the Oracle Database
Reference for a list of system lock types.)
There are only three types of user locks, TX, TM and UL. UL is a
user-defined lock -- a lock defined with the DBMS_LOCK package. The TX
lock is a row transaction lock; it's acquired once for every transaction
that changes data, no matter how many objects you change in that
transaction. The ID1 and ID2 columns point to the rollback segment and
transaction table entries for that transaction.
The TM lock is a DML lock. It's acquired once for each object that's
being changed. The ID1 column identifies the object being modified.
You can see more information on TM and TX locks just by looking at
the lock modes. The LMODE and REQUEST columns both use the same
numbering for lock modes, in order of increasing exclusivity: from 0
for no lock, to 6 for exclusive lock. A session must obtain an
exclusive TX lock in order to change data; LMODE will be 6. If it can't
obtain an exclusive lock because some of the rows it wants to change
are locked by another session, then it will request a TX in exclusive
mode; LMODE will be 0 since it does not have the lock, and REQUEST will
be 6. You can see this interaction in the rows we selected earlier from
v$lock:
Note that ID1 and ID2 in Session 2, which is requesting the TX lock
(LMODE=0, REQUEST=6), point back to the rollback and transaction entries
for Session 1. That's what lets us determine the blocking session for
Session 2.
You may also see TX locks in mode 4, Shared mode. If a block
containing rows to be changed doesn't have any interested transaction
list (ITL) entries left, then the session acquires a TX lock in mode 4
while waiting for an ITL entry. If you see contention for TX-4 locks on
an object, you probably need to increase INITRANS for the object.
TM locks are generally requested and acquired in modes 3, aka
Shared-Row Exclusive, and 6. DDL requires a TM Exclusive lock. (Note
that CREATE TABLE doesn't require a TM lock -- it doesn't need to lock
any objects, because the object in question doesn't exist yet!) DML
requires a Shared-Row Exclusive lock. So, in the rows we selected
earlier from v$lock, you can see from the TM locking levels that these
are DML locks:
Now that we know that each TM row points to a locked object, we can use ID1 to identify the object.
SQL> select object_name from dba_objects where object_id=88519 ;
OBJECT_NAME
--------------
TSTLOCK
Sometimes just knowing the object is enough information; but we can
dig even deeper. We can identify not just the object, but the block and
even the row in the block that Session 2 is waiting on.
This gives us the object ID, the relative file number, the block in
the datafile, and the row in the block that the session is waiting on.
If that list of data sounds familiar, it's because those are the four
components of an extended ROWID. We can build the row's actual
extended ROWID from these components using the DBMS_ROWID package. The
ROWID_CREATE function takes these arguments and returns the ROWID:
We've seen how to identify a blocking session, and how to inspect the
very row that the waiting session is waiting for. And, I hope, learned
a bit about v$lock in the process.
Natalka Roshak is a senior Oracle and Sybase database administrator,
analyst, and architect. She is based in Kingston, Ontario, and consults
across North America. More of her scripts and tips can be found in her
online DBA toolkit at http://toolkit.rdbms-insight.com/ .
LET p_log = p_fn CLIPPED,' ',p_src CLIPPED,'->',p_tag CLIPPED
WHENEVER ERROR CONTINUE INSERT INTO azo_file VALUES (g_prog,g_user,g_today,g_time,p_key,p_log) WHENEVER ERROR CALL cl_err_msg_log INSERT INTO tc_mem_file VALUES (g_prog,g_user,g_today,g_time,p_key,p_fn,p_src,p_tag) END FUNCTION
my $html = get("https://www.iyp.com.tw/showroom.php?cate_name_eng_lv1=leisure&cate_name_eng_lv3=Hotels&p=$i"); my $stream = HTML::TokeParser->new(\$html); my %image = ( );
例如我們想要 sfb01 這個欄位在某些情況下顯示藍色時,只要加判斷再加上 ATTRIBUTE,
例:
IF g_sfb01.sfb04 = '8' THEN
DISPLAY BY NAME g_sfb01.sfb01 ATTRIBUTE(BLUE)
ELSE
DISPLAY BY NAME g_sfb01.sfb01 ATTRIBUTE(BLACK)
END IF
但是如果是單身的話會用 DISPLAY ARRAY 就只能所有單身全部的顏色都變一樣,
要改用 DIALOG.setCellAttributes 的方式來顯示欄位的屬性。
例:
要先定義單身有那些是要動態變更欄位屬性的陣列變數:
DEFINE g_gen_attr DYNAMIC ARRAY OF RECORD
gen01 STRING,
gen02 STRING,
gen03 STRING
END RECORD
記得要先做 g_gen_attr.clear()。
在 fill() 函數時 FOREACH 的時候判斷:
IF g_gen[g_cnt].gen03 IS NULL TEHN
LET g_gen_attr[g_cnt].gen01 = 'MAGENTA REVERSE'
ELSE
LET g_gen_attr[g_cnt].gen01 = ''
END IF
# 有客户其他地址時顯示符號
LET l_cnt = 0
SELECT COUNT(*) INTO l_cnt FROM ocd_file WHERE ocd01 = g_occ.occ01
IF l_cnt > 0 THEN
LET w = ui.Window.getCurrent()
LET n = w.findNode("MenuAction","customer_address1")
CALL n.setAttribute("image","information")
ELSE
LET w = ui.Window.getCurrent()
LET n = w.findNode("MenuAction","customer_address1")
CALL n.setAttribute("image","")
END IF
# 有客户聯絡人時顯示符號
LET l_cnt = 0
SELECT COUNT(*) INTO l_cnt FROM oce_file WHERE oce01 = g_occ.occ01
IF l_cnt > 0 THEN
LET w = ui.Window.getCurrent()
LET n = w.findNode("MenuAction","customer_contact")
CALL n.setAttribute("image","information")
ELSE
LET w = ui.Window.getCurrent()
LET n = w.findNode("MenuAction","customer_contact")
CALL n.setAttribute("image","")
END IF
在 2000
年,Takanori Kawai 和 John McNamara 編寫出了 Spreadsheet::WriteExcel 和
Spreadsheet::ParseExcel 模塊並將它們張貼在 CPAN 上,這兩個模塊使得在任何平台上從 Excel
文件抽取數據成爲可能(盡管不容易)。 正如我們在稍後將看到的,如果您正在使用 Windows,Win32::OLE
仍提供一個更簡單、更可靠的解決方案,並且 Spreadsheet::WriteExcel 模塊建議使用 Win32::OLE
來進行更強大的數據和工作表操縱。Win32::OLE 帶有 ActiveState Perl 工具箱,可以用來通過 OLE 驅動許多其它
Windows 應用程序。請注意,要使用此模塊,您仍需要在機器上安裝和注冊一個 Excel 引擎(通常隨 Excel 本身安裝)。 需要解析 Excel 數據的應用程序數以千計,但是這裏有幾個示例:將 Excel 導出到 CSV、與存儲在共享驅動器上的電子表格交互、將金融數據移至數據庫以便形成報告以及在不提供任何其他格式的情況下分析數據。
要演示這裏給出的示例,必須在您的系統上安裝 Perl 5.6.0。您的系統最好是最近(2000 年或以後)的主流 UNIX
安裝(Linux、Solaris 和 BSD)。雖然這些示例在以前版本的 Perl 和 UNXI
以及其他操作系統中也可以使用,但是您應該考慮到您將面對那些它們無法作爲練習發揮作用的情況。 Windows 示例:解析 本節僅適用于 Windows 機器。所有其它各節適用于 Linux。
在進行之前,請安裝 ActiveState Perl(這裏使用版本 628)或 ActiveState Komodo IDE 以編輯和調試
Perl。Komodo 爲家庭用戶提供一個免費許可證,您大概在幾分鍾之內就可以得到它。(有關下載站點,請參閱本文後面的參考資料。) 使
用 ActiveState PPM 軟件包管理器安裝 Spreadsheet::ParseExcel 和
Spreadsheet::WriteExcel 模塊是困難的。PPM
沒有曆史記錄,難以設置選項,幫助會滾出屏幕並且缺省方式是忽略相關性而安裝。您可以從命令行輸入“ppm”然後發出以下命令來調用 PPM: 清單 1:安裝 Excel 模塊的 PPM 命令 ppm install OLE::Storage_Lite ppm install Spreadsheet::ParseExcel ppm install Spreadsheet::WriteExcel 在這種情況下,該模塊的安裝將失敗,因爲 IO::Scalar 還不可用,因此,您可能想放棄 PPM 問題的查找,而轉向內置的 Win32::OLE 模塊。然而,在您閱讀本文時,ActiveState 可能已經發布了該問題的修正。 有了 ActiveState 的 Win32::OLE,您可以使用下面所列的代碼逐個單元地轉儲工作表: 下載 win32excel.pl 清單 2:win32excel.pl #!/usr/bin/perl -w use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors... # get already active Excel application or open new my $Excel = Win32::OLE-GetActiveObject('Excel.Application') || Win32::OLE-new('Excel.Application', 'Quit'); # open Excel file my $Book = $Excel-Workbooks-Open("c:/komodo projects/test.xls"); # You can dynamically obtain the number of worksheets, rows, and columns # through the Excel OLE interface. Excel's Visual Basic Editor has more # information on the Excel OLE interface. Here we just use the first # worksheet, rows 1 through 4 and columns 1 through 3. # select worksheet number 1 (you can also select a worksheet by name) my $Sheet = $Book-Worksheets(1); foreach my $row (1..4) { foreach my $col (1..3) { # skip empty cells next unless defined $Sheet-Cells($row,$col)-{'Value'}; # print out the contents of a cell printf "At ($row, $col) the value is %s and the formula is %s\n", $Sheet-Cells($row,$col)-{'Value'}, $Sheet-Cells($row,$col)-{'Formula'}; } } # clean up after ourselves $Book-Close; 請注意,您可以用以下方式很輕松地爲單元分配值: $sheet-Cells($row, $col)-{'Value'} = 1; Linux 示例:解析 本節適用于 UNIX,特別適用于 Linux。沒有在 Windows 中測試它。 很難給出一個比 Spreadsheet::ParseExcel 模塊文檔中所提供的示例更好的 Linux 解析示例,因此我將演示那個示例,然後解釋其工作原理。 下載 parse-excel.pl 清單 3:parse-excel.pl #!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; die "You must provide a filename to $0 to be parsed as an Excel file" unless @ARGV; my $oBook = $oExcel-Parse($ARGV[0]); my($iR, $iC, $oWkS, $oWkC); print "FILE :", $oBook-{File} , "\n"; print "COUNT :", $oBook-{SheetCount} , "\n"; print "AUTHOR:", $oBook-{Author} , "\n" if defined $oBook-{Author}; for(my $iSheet=0; $iSheet {SheetCount} ; $iSheet++) { $oWkS = $oBook-{Worksheet}[$iSheet]; print "--------- SHEET:", $oWkS-{Name}, "\n"; for(my $iR = $oWkS-{MinRow} ; defined $oWkS-{MaxRow} && $iR {MaxRow} ; $iR++) { for(my $iC = $oWkS-{MinCol} ; defined $oWkS-{MaxCol} && $iC {MaxCol} ; $iC++) { $oWkC = $oWkS-{Cells}[$iR][$iC]; print "( $iR , $iC ) =", $oWkC-Value, "\n" if($oWkC); } } } 此示例是用 Excel 97 測試的。如果它不能工作,則試著將它轉換成 Excel 97 格式。Spreadsheet::ParseExcel 的 perldoc 頁也聲稱了 Excel 95 和 2000 兼容性。 電子表格被解析成一個名爲 $oBook 的頂級對象。$oBook 具有輔助程序的特性,例如“File”、“SheetCount”和“Author”。 Spreadsheet::ParseExcel 的 perldoc 頁的工作簿一節中記載了這些特性。
該工作簿包含幾個工作表:通過使用工作簿 SheetCount 特性叠代它們。每個工作表都有一個 MinRow 和 MinCol 以及相應的
MaxRow 和 MaxCol 特性,它們可以用來確定該工作簿可以訪問的範圍。Spreadsheet::ParseExcel perldoc
頁的工作表一節中記載了這些特性。 可以通過 Cell 特性從工作表獲得單元;那就是清單 3 中獲得 $oWkC
對象的方式。Spreadsheet::ParseExcel 的 perldoc 頁的 Cell 一節中記載了 Cell
特性。根據文檔,似乎沒有一種方式能夠獲得特定單元中列出的公式。 Linux 示例:寫入 本節適用于 UNIX,特別適用于 Linux。沒有在 Windows 中測試它。
Spreadsheet::WriteExcel 在 Examples 目錄中帶有許多示例腳本,通常可以在
/usr/lib/perl5/site_perl/5.6.0/Spreadsheet/WriteExcel/examples
下找到這些腳本。它可能被安裝在其它各處;如果找不到那個目錄,請與您的本地 Perl 管理員聯系。 壞消息是
Spreadsheet::WriteExcel 無法用于寫入現有 Excel 文件。必須自己使用 Spreadsheet::ParseExcel
從現有 Excel 文件導入數據。好消息是 Spreadsheet::WriteExcel 與 Excel 5 直至 Excel 2000
兼容。 這裏有一個程序,它演示如何從一個 Excel 文件抽取、修改(所有數字都乘以 2)數據以及將數據寫入新的 Excel 文件。只保留數據,不保留格式和任何特性。公式被丟棄。 下載 excel-x2.pl 清單 4:excel-x2.pl #!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; use Spreadsheet::WriteExcel; use Data::Dumper; # cobbled together from examples for the Spreadsheet::ParseExcel and # Spreadsheet::WriteExcel modules my $sourcename = shift @ARGV; my $destname = shift @ARGV or die "invocation: $0 "; my $source_excel = new Spreadsheet::ParseExcel; my $source_book = $source_excel-Parse($sourcename) or die "Could not open source Excel file $sourcename: $!"; my $storage_book; foreach my $source_sheet_number (0 .. $source_book-{SheetCount}-1) { my $source_sheet = $source_book-{Worksheet}[$source_sheet_number]; print "--------- SHEET:", $source_sheet-{Name}, "\n"; # sanity checking on the source file: rows and columns should be sensible next unless defined $source_sheet-{MaxRow}; next unless $source_sheet-{MinRow} (王朝網路 wangchao.net.cn)
例:執行 finderr -201 會出現以下訊息,英文應該大概上就知道什麼涵義:
-201 A syntax error has occurred.
This is the general error code for all types of mistakes in the form of
an SQL statement. Look for missing or extra punctuation (for example,
missing or extra commas, omission of parentheses around a subquery,
etc.), keywords misspelled (for example VALEUS for VALUES), keywords
misused (for example, SET in an INSERT statement, INTO in a subquery),
keywords out of sequence (for example a condition of "value IS NOT"
instead of "NOT value IS"), or the use of a reserved word as an
identifier.
Note: Database servers that support "full NIST compliance" do not
reserve any words; queries that work with these database servers may
fail with error -201 when used with earlier implementations.
The error_log() function sends an error to the server error log, a file or a
remote destination.
This funtion returns TRUE on success, or FALSE on failure.
Syntax
error_log(error,type,destination,headers)
Parameter
Description
error
Required. The error message to log
type
Optional. Specifies the error log type.
Possible log types:
0 - Default. The error is sent to the servers logging system or a file,
depending on how the error_log configuration is set in the php.ini file
1 - The error is sent by email to the address in the destination
parameter. This message type is the only one that uses the headers
parameter
2 - The error is sent through the PHP debugging connection. This
option is only available in PHP 3
3 - The error is added to the file destination string
destination
Optional. Specifies where to send the error message. The
value of this parameter depends on the value of the "type" parameter
headers
Optional. Only used if the "type" parameter is "1".
Specifies additional headers, like From, Cc, and Bcc. The additional headers
should be separated with a CRLF (\r\n).
Note: When sending an email, it must contain a From header. This
can be set with this parameter or in the php.ini file.
Example
The following example sends an e-mail with a custom error:
<?php
$test=2;
if ($test>1)
{
error_log("A custom error has been triggered",
1,"someone@example.com","From: webmaster@example.com");
}
?>
The mail received from the code above looks like this:
變數名稱:NLS_LANG 值:TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5 這值可以使用SQLPlus查詢,操作如下: a. 打開SQLPlus,輸入帳號:XX@DB字串,密碼:XXX。 b. 輸入SQL指令:select userenv(‘language’) from dual 。
你可以先在Vim Color Scheme Test网站中,预览各种配色方案的效果,然后再点击配色方案的名称进行下载安装。
你也可以在Vim.org中,查找并下载喜欢的配色方案。你甚至可以下载Color Sampler Pack,然后从其中包含的100个最受欢迎配色方案里慢慢挑选。
将下载的配色方案文件name.vim,放入$VIMRUNTIME/colors目录中;然后执行以下命令,就可以应用这个配色方案了: :colorscheme name
LET s_date = g_oea.oea02 USING "yyyy/mm/dd" PREPARE s2 FROM "select ds.axmt410.get_oeb15(?,?) from dual" EXECUTE s2 USING g_oea.ta_oea07,s_dateINTO p_date FREE s2
學校教育通常著重在知識、技能的養成,幫助學生未來能在各產業中發揮所能;然而,要如何爭取到理想工作,卻是時常被忽略的一課。美國網路媒體 THNKR 特此廣邀各領域職涯專家,提醒各位求職朋友面試時需著重的五大重點: 1. Practice and Prepare 練習與準備
萬全準備是求職的關鍵,了解該公司需求,表現出「我不只是要找份工作,而是要為貴公司工作」。此外,面試官不會著重在你過去的職位表現,他們想知道的是「當你面對危機時,你會怎麼處理?」務必準備好此類問題的回答,並多加練習如何清楚表達。
※Due diligence 原為商業用語,指的是企業在併購前對目標公司進行的評估動作,而後衍伸為「審慎調查、實質審查」的意思,現在也經常看到此詞語用在日常生活中。
影片中強調 Do your diligence 就是要求職者在前往面試之前,務必先調查該公司整體背景、營運狀況等,才能讓面試官感受到 You come prepared.(你有備而來)。 2. Be Memorable 加深印象
回答面試官問題時,切記以下三重點:
一、確實回答問題;
二、提出例子,讓面試官留下深刻印象;
三、表達出你的答案對他們、以及對那份工作來說是非常重要的。
面試官通常不是決定是否要雇用你的人,他們需要將資訊轉達至最終決策者,若你的應答能脫穎而出,爭取到職位的機會也相對提高。
3. Think about Perspective 想想對方觀點
「知己知彼,百戰百勝」了解該公司需求,站在面試官角度思考。美國商管類涯暢銷書作者丹尼爾·品克(Daniel H.
Pink)表示,許多求職者總是積極推銷自己的能力,強調「該職位由我接手必會不同凡響」;但面試官想要的是「能讓他們的生活更好過」的人,若能表現出這
一面,便能增加你的吸引力。
4. Honesty is the Best Policy 誠實為上策
若是與前公司不歡而散,或是因為某種原因遭到開除,別隱瞞、別說謊。在這資訊交流發達的年代,要查出你的背景完全不費力。記得,別數落前公司的不是,而是要準備談談價值觀的問題,說明你的離開是因為 value clash(價值觀衝突),而不是能力或態度問題。
5. Be Aware of Body Language 注意肢體語言
除言語表達外,肢體語言也能透露出你是否能勝任該職位。面試者常因緊張而往後退、雙手縮到桌面下、或是交叉雙腳,但這些動作都使你變得渺小,可能也表現出不真誠的樣子。將身體稍微往前傾、雙手置於可見範圍、維持良好視線接觸,如此才能傳達熱情及自信。
This HOWTO focuses on the situation where the user connects from
a Windows machine using TeraTerm with the SSH extension. The server is
assumed be a Unix-like machine which will only accept SSH connections from
the client.
In most of the examples, the server is assumed to be named "remote,"
the local machine to be named "local," and the file to be named "foo."
Samba
This ducks the entire issue. For a permanent installation, Samba is the
way to go. Samba is a fantastically useful program which allows files residing
on a unix machine to be shared with Windows machines. The Unix machine
will appear in the Network Neighborhood, and fine-grained control is available
to select which files are available to which users. Printing support is
also provided. Samba has to be installed by the system administrator. Be
sure to run NT service pack 3 or above, Windows 98, or recent upgrades
to Windows 95, otherwise your password will be leaked to the network. Also,
be sure to enable encrypted passwords in Samba, otherwise it will not be
able to talk to the Windows clients.
Samba can be installed by your system administrator
SCP
If you're connecting from a unix-like machine to a unix-like machine, this
HOWTO is not for you. Your situation is much easier. Use the command "scp"
which is analogous to the more common "rcp." If you want to copy the file
"foo" to the machine "remote" you would issue the following command:
scp foo remote: Note the colon at the end of the line. If you omit the colon, you
will just make a local copy of the file named "remote."
See the man page on scp for more information.
Modem-Style Transfer Programs
One way to transfer files over an SSH connection is to use modem-to-modem
transfer protocols like kermit or xmodem. This is probably the easiest
to set up. All the communication which would normally take place between
two modems is piped through the SSH connection. There's a lot of extra
overhead to this technique, so it may not be the best for large files over
slow connections.
Of the available options, ZModem is probably the easiest to use.
ZModem: Uploading Local to Remote
From the command line on the remote machine, type "sz filename" You
can specify multiple filenames on the same command line. You will see some
garbage appear on the screen. This is the sz program waiting to hear the
correct response. Your screen will look approximately like this:
[zager@marge zager]$ sz foo Š*B00000000000000
From the File menu in TeraTerm, select Transfer|ZMODEM|Receive. The file
transfer should begin.
ZModem: Downloading Remote to Local
From the command line, type "rz" You do not need to specify a filename.
rz will produce some garbage on the screen. Your screen will look approximately
like this.
[zager@marge zager]$ rz Šz waiting to receive.**B0100000023be50
From the File menu in TeraTerm, select Transfer|ZMODEM|Send... You should
see a standard Windows file selection dialog. Select the file(s) you would
like to send, click the "Open" button. The transfer should start
If something goes wrong with the transfer, sz and rz should both time out
eventually. Pressing Control-C, Control-Z, and otherwise pounding on the
keyboard has little effect.
sz and rz are programs which can be installed and run as a regular user.
No special priviledges are required.
FTP
It is much harder to configure FTP to work over an SSH connection. The
reason to do this is that you have some nifty graphical FTP clients on
your PC which you enjoy using, and use often. That will make it worth the
setup. Otherwise, you are encouraged to take a second look at the section
above.
Overview
The SSH protocol includes a feature known as "port-forwarding." This allows
a network connection which looks like it begins at one end of the SSH connection
to be sent through SSH to the remote end, and passed on elsewhere. We will
tell the LOCAL machine to listen for an ftp connection, then forward that
connection to the REMOTE machine. Then, to make use of this new link, we
will tell our FTP client to connect to the LOCAL machine instead of the
REMOTE one.
Preconditions
The remote server must be configured to allow ftp connections from itself,
even though it does not allow connections from the outside world. The system
administrator will have to do this. It may also be possible for you to
run your own renegade ftp server on a non-priviledged port.
Your ftp client must support passive mode. The default ftp clients in Windows
95 and Windows NT do not support passive mode. The fancier ftp programs
generally do. Internet Neighborhood, available at http://www.knoware.com
is a nice ftp program which does support passive mode.
You must have the SSH plug-in version 1.4 or higher. Maybe version 1.3
would work, I never saw it. But version 1.2 does not support port forwarding.
Configuring TeraTerm-SSH
Select the TeraTerm menu option Setup|SSH Forwarding... If you do not have
an option "SSH Forwarding..." under your Setup menu, then you need to upgrade
your version of the SSH plugin.
Click on the Add button
Forward from the local port "ftp" to the remote machine "remote" , port
"ftp."
Click on the Ok button
The "Port Forwarding" list should now have one entry: "Local 21 (ftp) to
remote "remote" port 21 (ftp)."
Click on the Ok button
Select the menu option Setup|Save Setup... to make your changes permanent.
Configuring your FTP Client
The particulars of how to do this will vary with your FTP client. But there
are two major steps:
Tell your ftp client that you want to connect to "localhost" This is counterintuitive.
Remember, the port forwarding is going to magically transmit this connection
to the other end, so it's ok.
Tell your ftp client to use passive mode. This may be under settings labeled
"advanced" or "firewall." If you are able to log in with your username
and password, but are not able to transmit any data, then you have not
enabled passive mode.
Once you have done these two steps, you should be able to use the ftp client
normally to connect to the remote site.
Special Case: Running an FTP server on the Client
If you are already running an FTP server on the client, then you have a
couple extra steps to do. SSH will not be able to set up its port forwarding
since your ftp server will already have control of the ftp port. The solution
is to use a non-standard port for the ftp connection.
When configuring Tera-Term SSH, instead of forwarding from the port
"ftp," pick a free port. You really should check what ports are free, but
a number like 54321 might be safe. The number should be over 1000 and less
than 65536.
When configuring the FTP client, look for a "port" option and set that
to the same port as you set for SSH. This is likely be be near where you
set the name of the machine to which you connect. (Which you set to "localhost,"
right?) There is also probably a "port" option near firewall settings,
but this is probably not what you're after.
Other Tricks
Forwarding Mail Connections
The standard POP and IMAP mail protocols blab your username and password
in cleartext, just like ftp would. If you use mail programs like Eudora,
Outlook, or Netscape Messenger, your password is probably being leaked.
You can do a similar trick of forwarding POP, POP3, or IMAP traffic through
SSH to secure these connections. Note that you will need to have an SSH
window open to the server in order to check your mail.