-f file unix
2012-04-10 14:41:26 sjmz30071360 阅读数 10

The default file permissions (umask):

Each user has a default set of permissions which apply to all files created by that user, unless the software explicitly sets something else. This is often called the 'umask', after the command used to change it. It is either inherited from the login process, or set in the .cshrc or .login file which configures an individual account, or it can be run manually.

Typically the default configuration is equivalent to typing 'umask 22' which produces permissions of:

-rw-r--r-- for regular files, or
drwxr-xr-x for directories.

In other words, user has full access, everyone else (group and other) has read access to files, lookup access to directories.

When working with group-access files and directories, it is common to use 'umask 2' which produces permissions of:

-rw-rw-r-- for regular files, or
drwxrwxr-x for directories.

For private work, use 'umask 77' which produces permissions:

-rw------- for regular files, or
drwx------ for directories.

The logic behind the number given to umask is not intuitive.

The command to change the permission flags is "chmod". Only the owner of a file can change its permissions.

The command to change the group of a file is "chgrp". Only the owner of a file can change its group, and can only change it to a group of which he is a member.

 

WARNINGS:

Putting 'umask 2' into a startup file (.login or .cshrc) will make these settings apply to everything you do unless manually changed. This can lead to giving group access to files such as saved email in your home directory, which is generally not desireable.

 

Making a file group read/write without checking what its group is can lead to accidentally giving access to almost everyone on the system. Normally all users are members of some default group such as "users", as well as being members of specific project-oriented groups. Don't give group access to "users" when you intended some other group.

 

Remember that to read a file, you need execute access to the directory it is in AND read access to the file itself. To write a file, your need execute access to the directory AND write access to the file. To create new files or delete files, you need write access to the directory. You also need execute access to all parent directories back to the root. Group access will break if a parent directory is made completely private.

读文件 需要: 文件的读权限 + 文件目录的执行权限(包括所有父目录的执行权限)

写文件 需要: 文件的写权限 + 文件目录的执行权限(包括所有父目录的执行权限)

新建/删除文件 需要: 文件目录的写权限(包括所有父目录的执行权限)

 

 

 

 

 

2014-02-23 20:32:00 weixin_34358092 阅读数 2

问个关于UNIX EXECUTABLE FILE的问题

如果是gui的,先启动x11(有的有可能需要xcode,xcode tools)
不然的话,可以试试
#chmod a+x file
#./file


转载于:https://my.oschina.net/gujianhan/blog/202476

2007-05-05 12:51:00 opl001 阅读数 437
 
 
2011-08-19 10:47:30 leo_wanta 阅读数 987


何谓core文件
    当一个程序崩溃时,在进程当前工作目录的core文件中复制了该进程的存储图像。core文件仅仅是一个内存映象(同时加上调试信息),主要是用来调试的。
1、unix  core文件
   有时自己的应用程序发生错误,比如访问非法内存地址等,就会造成CoreDump,这时系统将相关的内存映像存为core文件,以便分析。
dbx,gdb,ladebug等工具可以对core文件进行分析,能够定位到程序的哪一行出错。不一定只有供应商的工程师才搞得明白。

UNIX下core文件的分析
1、lquerypv -h core文件 6b1,可以查看到Core文件中报错的进程名字。例如:lquerypv -h core_20041210 6b1得到如下的结果,
2、采用file命令,直接 file core文件 即可
$ file core_20041210
core_20041210 AIX core file fulldump 32-bit, exe_CustInfo
3、可以采用strings命令,直接将core文件中的所有垃圾提示去掉,只提取有用的信息,比如采用:strings 文件 | awk '{if (NR<=5) print $0}',可以看到第二行就是产生
core文件的可执行文件
4、在AIX下可以采用adb,dbx工具。
5、在Linux下可以采用gdb工具。

unix下如何查看core dump时产生的core文件
dbx core
bug和操作系统或硬件的保护机制都会导致程序异常终止,操作系统会kill掉这些进程并产生core文件,程序员可以通过core文件来找出问题所在。它记录了程序挂掉时详细的状态描述。


Core文件分析
1. core文件的简单介绍
在一个程序崩溃时,它一般会在指定目录下生成一个core文件。core文件仅仅是一个内存映象(同时加上调试信息),主要是用来调试的。
2. 开启或关闭core文件的生成
用以下命令来阻止系统生成core文件:
ulimit -c 0
下面的命令可以检查生成core文件的选项是否打开:
ulimit -a
该命令将显示所有的用户定制,其中选项-a代表“all”。
也可以修改系统文件来调整core选项
在/etc/profile通常会有这样一句话来禁止产生core文件,通常这种设置是合理的:
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
但是在开发过程中有时为了调试问题,还是需要在特定的用户环境下打开core文件产生的设置
在用户的~/.bash_profile里加上ulimit -c unlimited来让特定的用户可以产生core文件
如果ulimit -c 0 则也是禁止产生core文件,而ulimit -c 1024则限制产生的core文件的大小不能超过1024kb
3. 设置Core Dump的核心转储文件目录和命名规则
/proc/sys/kernel/core_uses_pid可以控制产生的core文件的文件名中是否添加pid作为扩展,如果添加则文件内容为1,否则为0
proc/sys/kernel/core_pattern可以设置格式化的core文件保存位置或文件名,比如原来文件内容是core-%e
可以这样修改:
echo "/corefile/core-%e-%p-%t" > core_pattern
将会控制所产生的core文件会存放到/corefile目录下,产生的文件名为core-命令名-pid-时间戳
以下是参数列表:
    %p - insert pid into filename 添加pid
    %u - insert current uid into filename 添加当前uid
    %g - insert current gid into filename 添加当前gid
    %s - insert signal that caused the coredump into the filename 添加导致产生core的信号
    %t - insert UNIX time that the coredump occurred into filename 添加core文件生成时的unix时间
    %h - insert hostname where the coredump happened into filename 添加主机名
    %e - insert coredumping executable name into filename 添加命令名
4. 使用core文件
在core文件所在目录下键入:
gdb -c core
它会启动GNU的调试器,来调试core文件,并且会显示生成此core文件的程序名,中止此程序的信号等等
如果你已经知道是由什么程序生成此core文件的,比如MyServer崩溃了生成core.12345,那么用此指令调试:
gdb -c core MyServer
以下怎么办就该去学习gdb的使用了
5. 一个小方法来测试产生core文件
直接输入指令:
kill -s SIGSEGV $$
2017-01-14 16:17:21 Norwaykenny 阅读数 261

The Unix file system is characterized by:

1.a hierarchical structure.

2.consistend treatment of file data.

3.the ability to create and delete files.

4.dynamic growth of files.

5.the protection of file data.

6.the treatment of peripheral devices as files.


Other features:

1.the leaf node:directories,regular files,special device file.

2.the Unix system treat the FILE DATA and DIRECTORIES as unformatted stream of bytes.

   2.1.so,Programs access the data in file is defined by the system and is identical to all programs.

   2.2.Programs my interpret the byte stream as they wish.

3.permission to access a file is controlled by ACCESS PERMISSIONS,

   it can be set INDEPENDENTLY to control read,write,execute for:

      the file owner

      a file group

      everyone else


unix file 读写

阅读数 201

Unix File Permissions

阅读数 431

UNIX File IO

阅读数 14

Unix File Attributes

阅读数 409

unix文件属性,文件系统

博文 来自: xiaofanku
没有更多推荐了,返回首页