一些linux使用技巧

简介: 防止Apache泄露WEB的秘密Apache还是很好的WEB,但如果设置不当,也会造成WEB秘密被访问者下载,比如图标或软件,只要取消目录访问的索引文件就可以防止。
防止Apache泄露WEB的秘密 Apache还是很好的WEB,但如果设置不当,也会造成WEB秘密被访问者下载,比如图标或软件,只要取消目录访问的索引文件就可以防止。编辑httpd.conf文件, 原文件为: # # This may also be "None", "All", or any combination of "Indexes", # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews". # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # Options Indexes FollowSymLinks MultiViews 只要把“Indexes ”删除,用户就不可能访问到目录文件了! last 用户历史访问记录 who 当前用户状态 uptime 显示启动时间及CPU负载 uname -a 显示系统内核及硬件平台信息 free 显示内存信息 hostname 显示主机名 netstat -ant 显示TCP端口及连接 arp -an 当前活动的arp cat /etc/resolv.conf 显示DNS信息 ip rule list 显示高级策略路由列表 ip route list table main 显示高级策略路由主路由表 mount 系统磁盘挂表情况 “du”命令是用来确定磁盘空间的。例如:为了确定“/var/log”和“/home”目录的大小,用下面的命令: [root@deep]# du -sh /var/log /home 1.0M /var/log 66M /home /etc/named.conf DNS主配置文件 /var/named DNS实际数据文件 在windows下自动备份unix数据库 在windows机器上做ftp批命令文本: open 192.168.0.50 --指明要连接的unix服务器 user root 发送用户名 hbjmtsg 发送密码 cd/u/liasll_GB/database 指明所要备份的目录路径 bin 改为2进位模式 lcd e:/liasll 指明windows本机备份目录 mget 指明所要备份目录的所有文件 bye 离开 Linux网络上的表示: Destination 目标网络或主机的IP地址 Gateway 到达目的地址的网关 Genmask Flags 标志字段,描述这一路由的一些特性 Metric Ref 表示为了建一次连接,该路由使用的次数 Use 表示通过该路由传输的分组报方数 Iface 路由使用的网络接口 DNS资料记录类型 domainhost配置文件中资源记录类型主要有如下几种: NS 标明域的名字服务器 A 转换主机名到IP地址 PTR 转换IP地址到主机名 MX 标明发给些域的邮件应该送到的服务器 CNAME 定义主机别名 在定义这些资源记录时按DNS服配置要求在域名的最后一定要加“.”符号,否则就为不规范的记录,在进行相应的DNS解析服务时就会产生一定的错误影响。 wall 发消息(挺好玩的,呵!) lspci -v 查看硬件芯片 修改分辨率vi /etc/X11/FX86config,找到Monitor修改 时钟分为系统时钏和硬件时钟,在启动时,硬件时钟会去读取系统时钟的设置,然后系统时钟就会独立于硬件运作. 查看时钟: date 设置系统时钟: date 091713272004.30 格式: date 月日时分年.秒 查看硬件时钟: hwclock或clock,命令差不多. 设置硬件时钟: hwclock --set --date="04/11/2004 23:16:25" 或clock --set --date="04/11/2004 23:16:25" 硬件时钟与系统时钟同步: hwclock --hctosys或clock --hctosys 系统时钟与硬件时钟同步: hwclock --systohc或clock --systohc arp 查看本地的MAC地址 ifconfig eth0 210.75.32.28 netmask 255.255.255.128 broadcast 210.75.32.127 给eth0接口加入IP地址及掩码 ifconfig eth0 down 关闭接口 ifconfig eth0 up 打开接口 FTP命令: ls:列出远程机上改变工作目录 cd:在远程机上改变工作目录 lcd:在本地机改变工作目录 close:终止当前的ftp对话 get(mget):从远程服务器指定文件到本机 put(mput):从本机上传到远程服务器 bye:离开 more /root/.bash_history 查看历史命令 在一张网卡上绑定多个IP地址: ifconfig eth0:0 192.168.0.253 netmask 255.255.255.0 ifconfig eth0:1 192.168.0.252 netmask 255.255.255.0 把iso制作成虚拟光驱 dd if=/dev/cdrom of=jin.iso bs=2048 env命令用来查看环境变量 du -h 显示本目录的文件及各文件的大小 du -sh 显示目录占硬盘总的大小 Linux下如何查找文件? & 在当前目录下查找文件明为*.sql的文件: $find . -name "*.sql" & 查找大于100M的文件: find . -size +100000 & 查找含有"china" 的文件: find . -name "*" -exec grep -l "china" {}/ & 查找并删除tmp*的文件: find . -name "tmp* -exec rm {}/ & 查找7天没有被修改过的文件: find . -mtime +7 /boot/grub/grub.conf GRUB 配置 /boot/module-info-* 内核驱动信息 Module information for the Linux kernel /boot/System.map-* 系统例表 Map of the Linux kernel /boot/vmlinuz-* 内核 Linux kernel /etc/aliases 邮件别名 Mail aliases /etc/at.deny 被禁止的用户 User IDs of users forbidden to use the at command /etc/auto.master 自动mount Configuration file for the autofs daemon, which automatically mounts filesystems /etc/auto.misc Automounter map file /etc/crontab 系统日志 System cron file /etc/cron.daily/* 安全日志 Daily cron jobs /etc/cron.hourly/* 时志 Hourly cron jobs /etc/cron.monthly/* 月志 Monthly cron jobs /etc/cron.weekly/* 周志 Weekly cron jobs /etc/filesystems 支持的文件系统格式 Supported filesystem types /etc/fstab 文件系统mount Filesystems mounted or available for mounting /etc/group 系统组定义 System group definitions /etc/host.conf Resolver configuration file /etc/hosts 域名IP Map of IP numbers to hostnames /etc/hosts.allow 允许的IP ALL : 1.1.1.1 ALL : 2.2.2.* : deny sendmail : 3.3.3.3 : deny ipop3d : * sendmail : ALL : allow in.ftpd : * Hosts allowed to access Internet services /etc/hosts.deny 禁止的IP ALL:* Hosts forbidden to access Internet services /etc/httpd/conf/* Apache配置文件 Apache configuration files /etc/httpd/httpd.conf Web服务器配置文件 Web server configuration file /etc/initlog.conf 登陆配置文件 Logging configuration file /etc/inittab Configuration for the init daemon, which controls executing processes /etc/issue Linux kernel and distribution version trustix系统: 修改/etc/pam.d/su,注释掉下面一行,就可以su了 auth required lib curity/pam_wheel.so group=root 要ssh可以用root登录也是可以的阿,改/etc/ssh/sshd_config里面 PermitRootLogin yes 就好了 去掉网关 route delete default 加上网关 route add default gw xxx.xxx.xxx.xxx 察看路由 netstat -rn 手工增加一条路由: route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 手工删除一条路由: route del -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 fat32的分区 mount -o codepage=936,iocharset=cp936 /dev/hda7 /mnt/cdrom ntfs的分区 mount -o iocharset=cp936 /dev/hda7 /mnt/cdrom iso文件 mount -o loop /abc.iso /mnt/cdrom 软盘 mount /dev/fd0 /mnt/floppy USB闪存 mount /dev/sda1 /mnt/cdrom 所有/etc/fstab内容 mount -a 可以指定文件格式"-t 格式", 格式可以为vfat, ext2, ext3等. 访问DVD mount -t iso9660 /dev/dvd /mnt/cdrom或mount -t udf /dev/dvd /mnt/cdrom 注意:dvd的格式一般为iso9660或udf之一 加载光驱命令 mount -t iso9660 /dev/cdrom /mnt/cdrom 取消DHCP: #/etc/rc.d/init.d/xinetd stop 取消显示器休眠: #setterm -blank n (n为等待时间) 查看开机硬件网卡信息: #dmesg | more eth0 禁止ping: echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all 添加到/etc/rc.local里 防止某个文件被修改: chattr +i /etc/fstab chattr -i /etc/fstab 禁止本机443端口: iptables -A INPUT -p all --dport 443 -j DROP iptables -A OUTPUT -p all --sport 443 -j DROP 查看详细端口连接命令: cat /proc/net/ip_conntrack 查看端口上运行什么程序: lsof -i:22 启动后开启NumLock for t in 1 2 3 4 5 6 7 8 do setleds +num $t>/dev/null done tar 分卷压缩和合并 以每卷500M为例 tar分卷压缩:tar cvzpf - mytarfile.tar.gz | split -d -b 500m tar多卷合并:cat x* > mytarfile.tar.gz 查找大小为500K到1000K之间的文件 find -type f -size +500k -and -size -1000k 通过ppp0上网,做NAT转换: iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.20.0/24 -j MASQUERADE
目录
相关文章
|
10月前
|
Linux 开发工具 Windows
Linux使用小技巧
Linux使用小技巧
41 0
|
10月前
|
安全 前端开发 Linux
Linux使用YUM安装程序
本篇文章内容主要讲解YUM的简介以及系统安装光盘配置YUM库,首先会先了解YUM,然后学习YUM工具的使用,这就是本篇文章的学习内容,下面进入学习吧。
260 0
|
12月前
|
Linux
Liunx学习笔记(三) 文件权限
Liunx学习笔记(三) 文件权限
90 0
|
Linux Apache 数据安全/隐私保护
Linux 温习(八): 文件权限
权限的意义在于允许某一个用户或某个用户组以规定的方式去访问某个文件。例如,Apache 服务进程默认由 Apache 用户访问,除了 root 用户以外,其他用户均不能访问相关进程,这样就能通过在文件上设置用户或用户组的访问方式达到限制目的。
123 0
|
缓存 运维 监控
Linux使用和基础操作 | 学习笔记
快速学习Linux使用和基础操作
119 0
|
消息中间件 NoSQL Kafka
linux使用
linux使用初体验
|
Ubuntu 安全 网络协议
|
运维 网络协议 安全
linux使用技巧:使用脚本处理文件
liunx三剑客grep、sed、awk的基本用法和实用技巧,如何在linux运维中使用这三个工具提高效率
383 0
|
Linux Windows
【Linux第一课】Linux系统常用文件管理命令
【Linux第一课】Linux系统常用文件管理命令
|
Linux 网络安全 数据安全/隐私保护