Cleverly set up Sybase user rights to process processes

Source: Internet
Author: User
Tags printf sybase sybase database

In the process of using the Sybase database, we often encounter a lock on the Sybase database system, and in most cases the user must log on to the system through the Superuser identity to handle the process. In order to ensure the security of Sybase database system, Superuser password is often in the hands of the database administrator.

When the above situation occurs, if the database administrator is not in the field or other ways to deal with, although the verbal notification password can solve the immediate emergency, but the security of the database system will undoubtedly be seriously threatened; and restarting Sybase database system is also a solution, However, this approach is likely to result in the loss of data in the database, or even the collapse of the user database, do not use this method unless the last resort.

If you can set the user rights, so that ordinary users can also process processing, without knowing the Sybase database system Superuser password, is undoubtedly the best way to deal with the above problems. Now, the author of the above situation for the entire process of detailed introduction to everyone, for reference. Of course, you can set a common user password to suit your needs, or you can restrict more content to process processes in your database system. The specific process is shown in the following article.

1. Use the C language to write a program as follows.

#include < stdlib.h>
#include < string.h>
#include < fcntl.h>
#include < time.h>
#include < sys/types.h>
char *passwd() /*普通用户需要的密码: 简单加密后字符串*/
{
struct tm *tp;
long secs;
char *buff;
buff=(char *)malloc(30);
secs=time((long *)0);
tp=localtime(&secs);
sprintf(buff,"%02d%02d%d",tp->tm_mon+1+9,tp->tm_mday+2,8);
return(buff);
}
main()
{
char str1[80],str2[80];
int i;
printf("passwd:");
system("stty -echo"); /* 不显示*/
gets(str1);
system("stty echo");
for(i=3;i< 9;i++)str2[i-3]=str1[i]; /*截取输入6个字符*/
str2[6]=’\0’;
if (strcmp(str2,passwd() ) ){
printf("passwd error!\n");
exit(1);
}
setuid(0);
system("/sybase/atuo/sybase_kill");
printf("\n");
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.