3 回答
TA贡献1785条经验 获得超4个赞
settings.py
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.staticfiles',
)
urls.py
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
)
if settings.DEBUG:
urlpatterns = patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns
TA贡献1848条经验 获得超6个赞
两种方式:
使用命令usermod
禁止帐号myuser登录
usermod -L myuser
允许账号登录
usermod -U myuser123456
修改shell类型
chsh myuser -s /sbin/nologin
TA贡献1830条经验 获得超3个赞
在服务器上进行如下命令操作进行规则设置即可:
#iptables -A INPUT -s ip段/网络位数 -j DROP
例如:禁止172.16.1.0/24网段访问服务器,直接在服务器上用命令就可以实现
#iptables -A INPUT -s 172.16.1.0/24 -j DROP (添加规则,所有来自这个网段的数据都丢弃)
#/etc/rc.d/init.d/iptables save (保存规则)
#service iptables restart (重启iptables服务以便升效)
- 3 回答
- 0 关注
- 1280 浏览
添加回答
举报