Articles of linux

在linux etc / environment中,如何正确地转义前导“#”字符?

我想在AWS Linux AMI 2013.03的etc/environment存储系统范围的环境variables。 在这个例子中,我试图存储短语“#hello”。 看下面的例子。 echo $control产生 hello 我期望echo $test0 (下)产生: #hello 而是产生一个空行。 以下是我input到/etc/environment中的testing列表: control="hello" test0="#hello" test1="h\\#ello" test2="h\#ello" test3="h//#ello" test4="h/#ello" test5=h#ello test6=h\\#ello test7=h\#ello test8=h//#ello test9=h/#ello test10='h#ello' test11='h\\#ello' test12='h\#ello' test13='h//#ello' test14='h/#ello' 如果我注销,然后重新login到机器,它会正确parsing/ etc /环境。 控制条件通过echo $control 。 但是,没有一个testing用例正确回应。 在每个实例中,散列(#)之外的string不是被删除就是被忽略。 例如, echo $test5产生h 。 有没有更好的方法来正确逃避# ? 有趣的是,如果我执行source /etc/environment那么所有的预期工作,并确实都echo $control和echo $test产生预期的结果。 但是,在注销/login时,问题返回…

使用LDAP进行身份validation的Samba独立服务器:SID不匹配

我试图让我的新的桑巴服务器运行几天,我开始失去了我的脑海,没有搞清楚我做错了什么。 这是我的设置: 具有〜15个组和100个用户的OpenLDAP 2.4.21服务器,都具有存储在LDAP中的unix和samba密码,以及分配并存储在LDAP中的用户SID和主组SID,源自LDAP的SID服务器。 现在我想使用几个samba服务器来使用LDAP服务器来authentication用户。 samba服务器是一个使用ldap服务器configurationNSS / PAM的linux。 getent passwd / group将所有用户和ssh返回给所有用户的samba机器。 现在这里是smb.conf: [global] workgroup = XXXXX security = user passdb backend = ldapsam:ldap://myldapserver ldap suffix = dc=mydomain,dc=com ldap admin dn = cn=replicator,dc=mydomain,dc=com ldap user suffix = ou=users ldap group suffix = ou=groups ldap machine suffix = ou=computers ldap ssl = start tls ldap连接工作,如pdbedit -L显示 […]

在Fedora 18/19中configurationfirewallD

我是防火墙新手,已经阅读了文档,但我想也许我可以在这里和大家讨论一些事情。 所以我看到,firewalld现在已经取代了iptables服务作为Fedora 18的默认防火墙以及基于服务和区域的防火墙,而不是直接处理端口。 我特别感兴趣的是configuration防火墙,以防止一些常见的攻击,例如端口扫描,Ping Flood等,以前一直使用iptables来定义规则。我的想法是做同样的这个新的防火墙。 我已经看到这个直接的命令,将允许直接传递规则到防火墙,我们可以给它的iptables的参数,但同时维基说,使用**直接**设置的任何规则是临时的,当防火墙重新加载/系统重新启动时闪现。 有人可以帮我怎么做吗? 因为我需要这种免于常见攻击的保护,成为永久规则的一部分。 编辑:更具体地说,我想知道,是使用直接命令正确的方式来添加规则,以防止常见的攻击? 提前致谢

我应该在每台机器上pipe理LDAP中的Linux组吗?

我目前正在运行一个OpenLDAP服务器pipe理我的Linux用户,如posixaccount和posixgroup这样的元素: dn: cn=shellinger,ou=groups,dc=company,dc=com cn: shellinger gidNumber: 5001 objectClass: posixGroup objectClass: top dn: cn=shellinger,ou=people,dc=company,dc=com cn: Simon Hellinger uid: shellinger uidNumber: 5001 gidNumber: 5001 objectClass: inetOrgPerson objectClass: organizationalPerson objectClass: person objectClass: posixAccount objectClass: shadowAccount objectClass: top … 现在,除了主要组,Linux组成员在每台机器上都是本地pipe理的。 这工作,但我认为打败了集中用户pipe理的目的。 我想我想要的是分配给我的用户不同的组,取决于他们login的机器。 一般来说,我的用户在我的所有机器上都有一些有用的业务,所以我相信login限制(基于主机或某个组)对于我的用例来说太粗糙了。 我想限制他们可以在每台机器上做什么,而不是如果他们可以login; 并以我的心态转化为他们所在的Linux团队。 而且,对于每台机器上的每个用户,这些组(也就是这样的权限)可能会有很大的不同,在一台机器上拥有超级用户权限的人可能是下一个用户。 用我的外行人来说,这听起来像是基于angular色的小组任务,但是在把我的整个LDAP词汇扔到Google和serverfault之后,我似乎还是无法理解这一点。 总结一下,问题是:我的用例是否有效? 我正在以正确的方式进行吗? 我应该在LDAP中pipe理Linux组吗?

linux initcwnd和initrwnd通过/etc/sysctl.conf

大家好,我们知道,3.x内核有更高的TCP默认连接值,比如initcwnd和initrwnd。 对于2.x的朋友,有没有办法在/etc/sysctl.conf中设置这些而不是ip route方式? 而不是以下: sudo ip route change default via 192.168.1.1 dev eth0 proto static initcwnd 10 有没有办法在/etc/sysctl.conf中设置相同的? 谢谢

带有JSON响应的Nginx错误页面

我正在尝试向客户提供维护页面,以便在维护时向我的应用程序发出请求。 以下是我为此目的的nginxconfiguration。 server { recursive_error_pages on; listen 80; … if (-f $document_root/maintenance.html) { return 503; } error_page 404 /404.html; error_page 500 502 504 /500.html; error_page 503 @503; location = /404.html { root $document_root; } location = /500.html { root $document_root; } location @503 { error_page 405 =/maintenance.html; if (-f $request_filename) { break; } rewrite ^(.*)$ […]

ldap_add没有这样的对象(32)匹配dn dc = domain dc = com

当im试图用这个命令将用户导入到LDAP时: ldapadd -x -D "cn=Manager,dc=domain,dc=com" -W -f /etc/openldap/root.ldif 我有这个错误: ldap_add no such object (32) matched dn dc=domain,dc=com 让我给你看看这些文件: /etc/openldap/domain.ldif dn: dc=domain,dc=com dc: domain description: LDAP Admin objectClass: dcObject objectClass: organizationalUnit ou: rootobject dn: ou=People, dc=domain,dc=com ou: People description: Users of adminmart objectClass: organizationalUnit /etc/openldap/root.ldif dn: uid=root,ou=People,dc=domain,dc=com uid: root cn: Manager objectClass: account 有人可以帮助我吗? 谢谢

更改默认网关,多个NIC

我有Ubuntu 13.10(内核3.11.0-19-通用)。 启动时,networkingconfiguration如下: dor@ubuntu:~$ sudo ifconfig -a em1 Link encap:Ethernet HWaddr 44:37:e6:4c:ca:0a inet addr:10.1.0.102 Bcast:10.1.7.255 Mask:255.255.248.0 inet6 addr: fe80::4637:e6ff:fe4c:ca0a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:732 errors:0 dropped:0 overruns:0 frame:0 TX packets:79 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:68789 (68.7 KB) TX bytes:12907 (12.9 KB) Interrupt:20 Memory:fe600000-fe620000 eth5 Link encap:Ethernet HWaddr 00:0a:5e:50:cf:1e […]

如何获得btrfs子卷的大小(压缩与未压缩)

有没有一个命令获取btrfs子卷的磁盘大小? 文件系统是用-o compressed ,子卷包含很多压缩得很好的文件。 我可以在根文件夹中使用du ,但是我只能得到未压缩大小的总和,与df like命令相比也相对较慢。 (注意:这个问题不是关于这个子卷中包含的唯一数据的大小,以及它以COW方式从其他快照中获得的大小。)

Jetty JMX设置用于远程访问

我有一些JMX在Jetty上工作的问题(9.1.3.v20140225),所以我已经阅读了Jetty doco。 所以我在jetty.conf中添加了以下内容 # ======================================================== # jetty.conf Configuration for jetty.sh script # ——————————————————– # This file is used by the jetty.sh script to provide # extra configuration arguments for the start.jar command # created by that script. # # Each line in this file becomes an arguement to start.jar # in addition to those found […]