顯示具有 debian 標籤的文章。 顯示所有文章
顯示具有 debian 標籤的文章。 顯示所有文章

2014年12月2日 星期二

Linux sudo 加入使用者

步驟1.
用root權限加入#useradd UserXXX  (不會主動建立家目錄)
若已建立過user會出現#useradd: user 'UserXXX ' already exists

步驟2.
設定密碼passwd UserXXX 
輸入新的 UNIX 密碼:
再次輸入新的 UNIX 密碼:
passwd:密碼已成功地變更

此時尚未加入sudoers檔案
執行#sudo UserXXX出現
#UserXXX is not in the sudoers file.  This incident will be reported.
步驟3.
編輯vi /etc/sudoers 或
執行 #visudo(編輯/etc/sudoers.tmp)
root ALL=(ALL) ALL這行底下加入
UserXXX ALL=(ALL) ALL

sudo adduser  sudo
The change will take effect the next time the user logs in.
This works because /etc/sudoers is pre-configured to grant permissions to all members of this group (You should not have to make any changes to this):
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
As long as you have access to a user that is in the same groups as your "original" user, you can delete the old one.

Realistically, there are also other groups your new user should be a member of. If you set the Account type of a user to Administrator in Users Settings, it will be placed in at least all of these groups:
adm sudo lpadmin sambashare
Because your system configuration may vary, I suggest taking a look at the output of groups  to see what groups are normally in use.

Open a Root Terminal and type visudo (to access and edit the list).
Navigate to the bottom of the sudoers file that is now displayed in the terminal.
Just under the line that looks like the following:
    root ALL=(ALL) ALL
Add the following (replacing user with your actual username):
    user ALL=(ALL) ALL
Now save the file. The procedure for this will depend on your editor:
  • nano – CtrlO then Enter, then CtrlX to exit
  • vim – :wq

參考
sudo-user

How can I add a new user as sudoer using the command line?

My main username is not in the sudoers file


Debian裝在VMWare上 突然無法顯示ip 無法取得IPv4 Address只有IPv6

前幾天打開VM的時候原本用XShell可以連到linux系統的ip突然不能用了
後來直接VM安裝的linux終端機執行指令ifconfig
只有得到MAC實體位址和IPv6位址
搜尋的問題向網路上一些文章一樣
找不到eth0對應的IPv4 Address
eth0 Link encap:Ethernet HWaddr e8:03:9a:97:61:b1 inet6 addr: fe80::ea03:9aff:fe97:61b1/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:29576 errors:0 dropped:1 overruns:0 frame:0 TX packets:17045 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:37185910 (37.1 MB) TX bytes:1622658 (1.6 MB) Interrupt:20 Memory:f7100000-f7120000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1289 errors:0 dropped:0 overruns:0 frame:0 TX packets:1289 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:114509 (114.5 KB) TX bytes:114509 (114.5 KB)

根據文章的解法把IPv6取消或是設定eth0,NAT,DHCP
重新restart networking似乎都沒有得到解決的方法
因為在window的cmd執行arp-a或ipconfig都沒有找到相對應的實體位址
目前懷疑是vm的ip位址沒有分配好
後來重灌VM Tool(留下虛擬機安裝的系統)後執行ifconfig就正常了

雖然沒找出真正原因
筆記一下,希望之後熟悉後若再遇到,能夠找到解決方法或有高手可以指點一二


參考

VirtualBox: two network interfaces (NAT and host-only ones) in a Debian guest on Ubuntu

Inability to use IPv4-mapped IPv6 on debian squeeze

備註:
------解決思路---------------------- 
1.查看網卡是否正常連接。 
mii-tool eth0; 
2.查看網絡配置 那就接份了。