Not sure if this is the right place fo this but....I'm just learning to write bash scripts. I'm experimenting on a ubuntu server 11.04 virtual machine.As part of the script I want to automate user creation.Is there a way to check if a user already exists in a script. so i can do something like
Code:
if userexists; then
do this
else
do this instead
fi
I have one file called test.sh and in that file I have the below code. All this code is, is paths to three directories (as you can you can clearly see!).
Code: #!/bin/bash BACKUP="Documents /bin /sbin"
Now I have this other file which reads the directories (by using $BACKUP) and creates a tar file of everything in that folder. But what I am unsure of what to is create a bit of code that will simply look in test.sh, read all the directories and print a line saying either they all exist or some are missing. If possible it would be good to know which directories are missing too!
I have fiddled around with using -d but I can only get it to work for one directory or manually having to write out each directory.
I wanted to use ldap to create users on my machine.I got LDAP set up via yast, and it seems to work OK. But when I create a user via LDAP, the system doesn't seem to want to know.LDAP actually creates a home directory for the new user, but the system merely assigns it a UID and nothing else.I have access to another opensuse system which does not behave in this way. I.e. I can set up a user exclusively in LDAP and the system will recognise the new user no problem.I have compared the two ldap configurations to see if there's some magic "propagate LDAP users to Local users" setting, but this doesn't appear to exist
If I want to add Windows & Mac users as Samba users, must I first add them all as Ubuntu users? If so, since none of the other users will actually be working on the Ubuntu Server, how do I disable the other non-admin users on the Ubuntu Server login screen. I am using Webmin to administer some server settings, and command line for others.
I want to migrate, or better saying, escape from Windows. When you create users in W, an All Users folder is created, where everyone has access to share documents and folders.
Do we have that in Ubuntu? I guess the folder should appear at the same level if the other users' folders, in Home, right?
But even with administrator account-type, I can't create that folder.
I'm setting a cookie value using RewriteRule statements in .htaccess for checking if my site should not redirect from the main desktop site to the mobile site (when accessed via iphone browser). The problem occurs when the first RewriteRule sets "mobile=desktop" in the cookie (from detecting "?desktop=true" in the querystring), the third RewriteRule fails to detect the new cookie value and redirect. If I reload the page again (without any querystring for "?desktop=true"), then the third RewriteRule redirects successfully.
Can anyone tell me why the third RewriteRule fails to detect the cookie value straight after it is set in the first rule? How can I fix this to work properly?
I would like to find where logs form dmesg(command) are stored on my hdd drive. I'm testing broken hdd with badsectors, and I've got some i/o errors, that I can read (just the most recent) using dmesg command (dmesg buffer). I would like to see whole log, that is interesting for me, but I cannot find where it is stored in /var/log
dmesg command(buffer) (last few lines) Code: [245129.080558] end_request: I/O error, dev sdb, sector 218246624 [245129.080562] Buffer I/O error on device sdb, logical block 27280828 [245132.037921] sd 2:0:0:0: [sdb] Unhandled sense code [245132.037925] sd 2:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [245132.037928] sd 2:0:0:0: [sdb] Sense Key : Medium Error [current] [245132.037932] sd 2:0:0:0: [sdb] Add. Sense: Unrecovered read error [245132.037936] end_request: I/O error, dev sdb, sector 218246624 [245132.037940] Buffer I/O error on device sdb, logical block 27280828 .....
I currently run a server. The web server (Abyss X1) runs on Linux, and the MTA server (MERCURY) runs in a virtualized Windows environment, within Linux.
I am soon going to be building a dedicated server, and at the moment it looks like it will be a Windows-based server, as I can't find MTA software for Linux with the feature I require.
I need MTA software that can show me network verbose output in real time, as such does MERCURY in the following screen shot: [url]
Does anyone know if such MTA software for Linux exist?
MERCURY does not work correctly under WINE, so the WINE method is not an option.
I have Apache/2.2.14 (Ubuntu) DAV/2 SVN/1.6.6 mod_fcgid/2.3.4 Phusion_Passenger/2.2.14 PHP/5.2.10-2ubuntu6 with Suhosin-Patch configured In UBUNTU 10.04 I like to install apache2 mod_perl I make apt-get install libapache2-mod-perl2 and I get: Quote: libapache2-mod-perl2 is already the newest version.
Ok I try sudo a2enmod mod_perl ERROR: Module perl does not exist! how I make Perl work in apache2 UBuntu 10.04
I am running Ubuntu 10.04 x86 64 bit Desktop.I want to accomplish setting up a virtual host environment for education reasons. How may I accomplish this? So far I am going by this following guide: URL... But when I get to the part of entering the command in the terminal "a2enmod fcgid" I get the following error: "ERROR: Module fcgid does not exist" I've been pulling my hair and spent a ton of time trying out how to set up suexec and virtual hosting .
Have Apache running on Ubuntu Server. Say I have a domain, www.somewhere.com, and I have uploaded a file, phpinfo.php. If I hit http://www.somewhere.com/phpinfo.php, I get my file as expected. However, If I hit non-existent file http://www.somewhere.com/phpinfo/somefile.dat, it also acts as if I hit phpinfo.php, instead of giving me a 404 error. It seems that because the DIRECTORY "phpinfo" does not exist, it decided that I must have meant to hit phpinfo.php at the root of the site.
If I create an empty "phpinfo" directory then it behaves as expected and gives me a 404 not found page. This is reproducible for any other file name you can think of. I'm sure this is some Apache convenience behavior but I would like to disable it (it is messing with some mod_rewrite stuff I would like to do). Because it's hard to describe I cannot figure out which Apache option it might be (whatever I Google for gives me completely unrelated results).
how to Check the disk usage of different linux servers using df -h linux command. My host server is 66.50.100.1, I can check its disk usage by using df -h command. I got my disk usage. Now using my host server Im going to check the server 66.50.100.3 disk usage. Is its possible to check the disk usage of 66.50.100.3 using my host server?
When using the following cifs mount command, mount -t smbfs -o username=username,password=password //srv/shr /usr/localfolder/and the cifs share does not exist, localfolder is mounted like d????????? ? ? ? ? ? localfolderafter a number of time , when umounting we get a kern <soft lock>Is there any way to fail the mount if the destination share does not exist, ive had a quick look through man mount but can not see a solution.
Sometimes at startup I get this message "Checking disk 1 of 1". Does that mean it's checking all partitions on the hd? After a bad shutdown there is no prompt for fsck to run and the system just boots up. In fstab I have both options set to "1" for the partition Ubuntu is on, all others set to "0". Any ideas on both?
I wonder if other people have this problem. sometimes I need to duplicate most or all of a server from one machine to another. part where I most tend to have issues is with recreating the users. Sometimes the UIDs don't match up because of differences between the two systems, which gives funky results, like files owned by the wrong user.
Or, sometimes, I just need to create the same 10 users on x number of machines, and it's tedious to do this 10x times. Plus, then, if you need to change a password or delete a user, you have to do it x times.Any recommendations on how to centralize users/auth?
I have created my own server with php, mysql and pma. I want to creat users and disable ssh so they can only user their username and password to get access to /home/<username> with a ftp program.
I have a ubuntu server 8.10 running on my dedicated server. How do I allocate IPs for users ? I have 3 IPs and 3 users running, I want each user to use a Single unique IP for all inbound and outbound traffic Also disallow a user from using the IP other then the one allocated to him. I tried to work out a solution using Iptables, but it does not work I suppose
My problem is quite simple, when I set up squirrelmail I only had one user on the server, and now that I have created new users, I can not log in to their accounts via squirrelmail I am using Maildir System is 10.04 server, running postfix and dovecot. I origionaly set up 'remote' as a user, I can send and recive mail on that account and log into squirrelmail
any new accounts can send email to remote(via outlook/thunderbird), to be seen in Squirrelmail, but get an invalid username/password when I try to log into squirrelmail in short, new accounts can not log into squirrelmail
I need to setup a simple server to make available Quickbooks accounting data to just a few stations. Can this be done with Ubuntu desktop version? Would it be recommended due to the small number of users? Or should I use a server platform?I have never used Linux before but have used command line interfaces and am looking forward to it. I installed Ubuntu Server 9.10 32 bit and have even gone as far as logging in. Amazing I know. I installed it on a separate disk so I can switch between Windows and Linux startup disks at boot via cmos.as a first step into linux would like to be able to browse the web from Ubuntu Server 9.10 if the Server edition is in fact the route I should be taking.I would also like a good source to learn not only command line commands but also all the stuff that I see after the commands, you know, all the stuff with - signs all over the place.
I'm using vsftpd on my server. When I connect (using file-zilla) from other computers on the same network I can't download any files. I can upload, create directories, and delete stuff, but I can't download. I've disabled anonymous access and enabled local user log-in. My /etc/vsftpd.conf
Code: # Example config file /etc/vsftpd.conf # # The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults.
I have two ubuntu 10.04 64-bit servers running samba (3.4.7) and openLDAP (2.4.21). The LDAP directory is successfully replicating between the two servers. These servers also serve as LDAP servers for sudo, pam, nss, and other services for a dozen servers without issues. The BDC samba is configured to use itself for LDAP. I connected to the BDC using the samba ldap credentials and verified I could a) see the Computer object b) read NTPassword and LMPassword. The workstations can authenticate to the domain successfully against the PDC. If a workstation boots and connects to the BDC, they login fails with:
Code: [2010/07/18 11:46:23, 0] rpc_server/srv_netlog_nt.c:336(get_md4pw) get_md4pw: Workstation MACHINENAME$: no account in domain [2010/07/18 11:46:23, 0] rpc_server/srv_netlog_nt.c:584(_netr_ServerAuthenticate3) _netr_ServerAuthenticate3: failed to get machine password for account MACHINENAME$: NT_STATUS_ACCESS_DENIED
Successful authentication against the PDC shows: Code: [2010/07/18 11:59:20, 1] smbd/service.c:1063(make_connection_snum) MACHINENAME (192.168.2.145) connect to service netlogon initially as user username (uid=30000, gid=512) (pid 1727) [2010/07/18 11:59:20, 1] smbd/service.c:1063(make_connection_snum) MACHINENAME (192.168.2.145) connect to service data initially as user nobody (uid=65534, gid=65534) (pid 1727) .....
installed Ubuntu Server Edition and I've found that my first user has a bash history and I can turn on a coloured prompt by editing my .bashrc etc but new users don't have that!I did : useradd -d /home/newb -m newbpasswd newband the correct looking .bashrc file appears to be in /home/newb but it is being ignore by bash when logged in as newb. Instead I am presented with just a dollar prompt instead of "newb@server"how can I sort out my users with proper prompts?
I am moving a webserver from a Gutsy to Lucid server. The webserver works fine, but I am having a problem with the users. I moved the home directories, along with passwd, group, shadow, and gshadow. The users can login fine, and their home directories are fine. The problem is when they try to logout, they get
GUI for several thousand simultaneous users. I know this post may at first seem a little out of place here when you begin to read it but please bear with me and I think you will understand why I am seeking feedback here. The company I work for (whose name I am withholding for now) is currently running a little over 5,000 Linux servers. Each of these servers has a minimum of 500 users, some as many as 3,000 users on them during a business day.
These servers are serious pieces of hardware. They have hot swappable raid arrays, redundant well most everything is redundant on them, frankly. Our conversion to Linux took place about 8 years ago. We have a proprietary database and development environment that was originally built in the 1970s. All but the most recent applications run in this proprietary environment, whereas our newer applications are using PostgreSQL and executables that are delivered using Apache web server and run inside each users Windows Explorer session on their local PC.
Really, our situation is rather typical of any organization that has legacy software that still gets the job done - with the possible exception of the **massive** number of total users we keep up-and-running every day. more, our next Linux servers are expected to support somewhere between 6,000-8,000 users [exact figure yet to be determined]. You may ask this is all very interesting but why are you posting this here?.
I am researching alternate ways of presenting attractive and functional GUI to users of Linux servers. I find the Ubuntu GUI to be attractive and very functional. the user input these forums get. Finally I am looking for points of view outside my own organization so I don't fall into the 'but we don't do it that way here' mental trap and miss a really great concept.
I have an idea about how to solve this growing challenge, and I want to present it here for your review and comments. For those who might think I have never worked on systems of this size; I can't imagine my opinion would be valuable remember this: The Ark was built by a passionate volunteer; The Titanic was built by paid professionals.....
How do I migrate my user list to a new server installation? I thought that just copying /etc/passwd and /etc/shadow would be enough. I recently tried upgrading a lightweight bazaar server to 11.04, and the upgrade crashed. I had to perform a new installation of Ubuntu to recover operation of the system. I installed on a different hard drive. I had a dozen other people with user logins, so that they can get or modify bazaar repositories.
The new installation is running, and I can read all of the files on my old system's / drive. I tried copying the /etc/passwd and /etc/shadow files onto my new /etc -- but that did not seem to work. (When I looked using the System->Administration->Users-and-Groups GUI tool, there were no users visible, so I restored the old files.) What I intended to do was to clone the /etc and /home trees over to the new system. What am I missing?
I have a server setup with all my web development stuff in /var/www and in several sub-folders within that. (each project having it's own folder)It works great with one FTP account. But recently I've been getting help on a projects from a buddy of mine that freelances, and have made him an FTP user account as well. All is fine, except for when he tries to edit a file and gets a permissions error.
Here's the issue, I don't want us to have the same FTP login, but all the files are currently owned by my user name. So, when he logs in to edit a file, he can't because I'm the owner, and the files are set to 744. Will I cause any harm by adding both users to the same group (www-data) and chmod'ing the files to 775 so that we can both access and modify the files?