日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

Ubuntu系統(tǒng)讓你的sudo不在輸入密碼_Linux學(xué)院_風(fēng)信網(wǎng)

 鷹擊彩霞 2016-06-14

很多人問怎么樣讓sudo記住密碼
我找到以前一個(gè)提速腳本
看見可以通過修改/etc/sudoers
sudo vi /etc/sudoers
把/etc/sudoers里面最后一行
%admin ALL=(ALL)
改為
%admin ALL=(ALL) NOPASSWD: NOPASSWD: ALL
然后強(qiáng)制保存 wq 就OK
以后sudo不在需要密碼
但是個(gè)人認(rèn)為這樣會(huì)存在風(fēng)險(xiǎn)
個(gè)人建議使用sudo su

ps:把這個(gè)提速腳本一起給出
#!/bin/sh

######################################################################################
# faster-dapper.sh - Tweak default settings to speed up Ubuntu 6.06 Dapper Drake #
# Usage: ./faster-dapper.sh as a user in the admin group with full sudo access #
# #
# Version 0.4 written July 8, 2006 by Jeff Schroeder (jeffschroed@gmail.com) #
# License: GNU GPL 2 ONLY. See http://www./licensing/licenses/info/GPLv2.html #
######################################################################################

INSTALLED_DRIVE='`fdisk -l | grep Linux | head -1 | cut -d' ' -f1 | cut -d'/' -f3 | sed 's/[1-9]//'`'

# Disable sudo asking for your password for the remainder of the script
sudo sed -ie '/^%admin/s/ALL$/NOPASSWD: ALL/' /etc/sudoers

# Are we running on Dapper?
if ( ! grep 'Ubuntu 6.06' /etc/issue >/dev/null 2>&1); then
echo 'This script is only intended for Ubuntu 6.06 Dapper Drake'
exit 1
fi

logger ' -===== Installation log started on $(date) for faster-dapper.sh =====- ' #Logs installation information to /var/log/messages
echo ' -===== Installation started on $(date) for faster-dapper.sh =====- '

# Update the system
#sudo apt-get update && sudo apt-get --yes upgrade

# Enable the Completely Fair Queuing Linux process scheduler to handle high CPU usage situations better
if (! grep 'elevator=cfq' /boot/grub/menu.lst > /dev/null 2>&1); then
logger ' Kernel process scheduler changed to CFQ'
sudo sed -ie '/# defoptions/s/splash/splash elevator=cfq/' /boot/grub/menu.lst
sudo update-grub
else
echo 'Kernel process scheduler is already CFQ'
fi

# Preload is an adaptive readahead daemon. Read /usr/share/doc/preload/proposal.txt.gz after installing preload for more info
if [ ! -f /etc/preload.conf ]; then
logger ' Installed preload'
sudo apt-get --yes install preload
else
echo 'reload already installed'
fi

# Enable prelink which causes big applications like firefox and OO.o to load faster
if (! grep '^PRELINKING=yes' /etc/default/prelink > /dev/null 2>&1); then
logger ' Installed prelink'
sudo apt-get --yes install prelink && sudo sed -ie 's/unknown/yes/' /etc/default/prelink

# Uncomment this if you don't keep your computer on all night and want to have prelink run on newly installed software
# NOTE: This makes apt-get upgrade or apt-get dist-upgrade take a loooooong time.
#echo 'DPkg:ost-Invoke {'echo Running prelink, please wait...;/etc/cron.daily/prelink';}' >> /etc/apt/apt.conf

echo -n 'Running prelink for the first time so this might take awhile...'
sudo /etc/cron.daily/prelink && echo 'done'
else
echo 'relinking already enabled'
fi

# Disable ipv6 to improve network responsiveness and speed dhcp lease negotiation at boot time
if [ -d /etc/modprobe.d ]; then
if ( ! grep 'net-pf-10 off' /etc/modprobe.d/aliases > /dev/null 2>&1 ); then
logger ' Disabled ipv6'
sudo -u root echo 'alias net-pf-10 off' >> /etc/modprobe.d/aliases
fi
if ( ! grep 'ipv6 off' /etc/modprobe.d/aliases > /dev/null 2>&1 ); then
logger ' Disabled ipv6 alias'
sudo -u root echo 'alias ipv6 off' >> /etc/modprobe.d/aliases
fi
fi

# Speed up gnome a bit
logger ' Improved gnome speed'
gconftool-2 --set --type boolean /desktop/gnome/interface/enable_animations false
gconftool-2 --set --type boolean /apps/panel/global/enable_animations false
gconftool-2 --set --type string /apps/nautilus/preferences/preview_sound never
#gconftool-2 --set --type string /apps/nautilus/preferences/show_p_w_picpath_thumbnails never
#gconftool-2 --set --type string /apps/nautilus/preferences/show_icon_text never

# Performance tweak to speed up your hard drive
#logger ' Enabled IDE hard disk tweaks'
#sudo /sbin/hdparm -u1 -m16 -c1 -A1 -a64 -d1 -K1 $INSTALLED_DRIVE > /dev/null

# Performance tweak to speed up ext3 partitions with lots of files
#for volume in $(mount 2> /dev/null| grep ext3 | awk '{print $1}'); do
# logger ' Enabled dir_index ext3 option for $volume'
# sudo tune2fs -O dir_index '$volume'
#done

# Enable dash as /bin/sh to run shell scripts instead of bloated bash
# See
#if ( ! dpkg -l dash >/dev/null 2>&1 ); then
# sudo apt-get install dash && sudo update-alternatives --install /bin/sh sh /bin/dash 1
#else
# sudo update-alternatives --install /bin/sh sh /bin/dash 1
#fi

# Disable unnecessary services.
# Remove any of these if you use them: hplip: hp printers, bluez-utils: bluetooth, pppd-dns: dialup users.
for service in hplip ppp festival bluez-utils mdadm apmd brltty lvm evms pppd-dns waitnfs.sh; do
logger ' Disabled service $service'
sudo /etc/init.d/$service stop
sudo update-rc.d -f $service remove
done

# Disable more unnecessary services if the computer is not a laptop
# Comment out this section if you are using a laptop
for service in laptop-mode pcmcia pcmciautils; do
logger ' Disabled service $service'
sudo /etc/init.d/$service remove
sudo update-rc.d -f $service remove
done


# Re-enable password prompts for users in the admin group running sudo
#sudo sed -ie '/NOPASSWD/s/NOPASSWD: //' /etc/sudoers

logger ' -===== Installation log finished on $(date) for faster-dapper.sh =====- '
echo ' -===== Installation finished on $(date) for faster-dapper.sh =====- '

echo ' '
echo 'Your installation of Ubuntu 6.06 Dapper Drake should run faster now...'
echo 'lease reboot your computer for some changes to take affect.'

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多