执行tcl命令时“couldn't create error file for command: permission denied”错误的解决

在某台Solaris服务器上, 执行如下命令会报错:

coolap13>1> tcl

tcl>execksh "whence $argv0"

Error: couldn't create error file for command: permission denied

一开始我先去查/var/log/syslog,结果发现/var/log下面为空,于是以为这就是上面报错的原因,就创建了一个authlog在/var/log下面。重新执行以上命令,错误继续。

Google了一下“tclcouldn't create error file for command: permission denied”,发现了这篇文章, 才恍然大悟:原来Tcl在执行时会在临时会检查临时文件夹是否可写,该临时文件夹在UNIX下面一般是/var/tmp。 我查了一下那台机器的/var/tmp,发现普通用户没有写权限。于是将它对的属性改为777,就OK了!

------------------------------

附上那篇文章的原文:

If exec returns an error message of "couldn`t create error file for command: Error 0", the following may help: 

This problem exists under Unix and Windows NT. I have conclusive proof that under Unix it was being caused by the temporary
directory not being world writable, which explains why superusers were able to "exec" something but not a regular user. The
"gotcha!" is that /tmp is not necessarily the temporary directory that is used, so people were not seeing an obvious problem. Tcl
uses the tmpnam() system call, which on many systems actually uses /var/tmp, and on some systems that directory was not world
writable. I would like to call this a problem with one`s site administration.

Here`s a simple program to determine your temporary directory:

 

which prints out the full pathname for a potential new temporary file. If the specified directory is not world writable, you can`t
create temp files. 

Now, the question turns to Windows. This I have not yet resolved. Under NT, which has users and directory permissions, it may be
the same problem as under Unix. However, since this problem is also occurring under Windows 3.1 it may be another problem or
combination of the two. 

-Colin Stevens

On Windows, you will need to set both the TMP and TEMP environment variables, for example: 

SET TMP=C:TEMP
SET TEMP=C:TEMP

-Richard Ross-Langley

你可能感兴趣的:(Permission)